Day 27/100 – Java Programming Journey. Today I learned about static methods in Java and how they behave based on return types and parameters. This topic cleared many small but important doubts. 🔹 Types of static methods I learned 1️⃣ Static method without return value (void) Used when a method performs an action but doesn’t send anything back. 2️⃣ Static method with return value (int, double, etc.) Used when a method processes data and returns a result to the caller. 3️⃣ Static method with parameters Example: static int add(int a, int b) Here I learned an important rule: Each parameter must have its own data type Writing int a, b is valid only inside a method body, not in the parameter list 4️⃣ Static method without parameters Used when no external input is required and the logic is fixed. 🔹 Parameter vs Argument (very important) Parameter → acts like a container that receives values Argument → the actual value passed to the method during the call ⚠️ Interview Question I learned today What happens if we write statements after a return statement? 👉 They cause a compile-time error because return ends the method execution. Any code written after it becomes unreachable. 💡 Understanding static methods helps in writing utility functions, reusable logic, and clean program flow. Learning step by step and clearing fundamentals. #Java #StaticMethods #ProgrammingBasics #100DaysOfCode #LearningJourney #InterviewPrep 10000 Coders Meghana M
Java Static Methods: Void, Return Value, Parameters & Interview Prep
More Relevant Posts
-
🚀 Exception Handling in Java – A Must-Have Skill! Yesterday, I taught exception handling in Java in great detail using this PDF. The session covered both theoretical concepts and practical examples, helping students clearly understand how exceptions work in real-world applications. It was a very interactive and insightful session, and I’m glad to see students actively engaging and asking thoughtful questions. Teaching not only helps students grow but also strengthens my own understanding. Looking forward to more such sessions! 🚀 Exception handling helps us write robust, readable, and crash-free Java applications. Instead of letting our program fail unexpectedly, we can handle errors gracefully. 🔹 Why exception handling? Prevents program crashes Improves user experience Makes debugging easier Keeps code maintainable 🔹 Common keywords try, catch, finally, throw, throws 📌 Example: public class ExceptionDemo { public static void main(String[] args) { try { int result = 10 / 0; // risky code System.out.println(result); } catch (ArithmeticException e) { System.out.println("Error: Cannot divide by zero"); } finally { System.out.println("Execution completed"); } } } ✅ The program doesn’t crash ✅ The error is handled properly ✅ finally always executes Yesterday I am teach to student in very details using this pdf. #Java #ExceptionHandling #JavaDeveloper #Coding #Programming #LinkedInLearning
To view or add a comment, sign in
-
Day 6 – Strengthening Java Fundamentals 🚀 Today’s session focused on some of the most important and frequently tested Java concepts that play a major role in interviews and real-world coding. 🔹 Increment & Decrement (Golden Rules) Understood the difference between pre-increment (++a) and post-increment (a++) and how they affect the value during execution, not the variable itself. 🔹 Operator Precedence & Associativity Learned how Java evaluates complex expressions using: Parenthesis first Increment/Decrement Arithmetic operators Assignment Also understood left-to-right associativity when precedence is the same. 🔹 Integer Division – Common Interview Trap Explored why expressions like 10 / 121 return 0 👉 Because int / int → int, and the decimal part is discarded. 🔹 Complex Expression Evaluation Solved step-by-step expressions by: Following precedence rules Applying pre/post increment carefully Writing values instead of guessing 🔹 Hard Coding vs Dynamic Input Why hard coding is a bad practice and how dynamic input makes programs flexible and reusable. 🔹 Scanner Class (User Input Handling) Learned how Java takes input from the keyboard using java.util.Scanner and how the program waits, reads input, stores values, and continues execution. 🔹 Interview Communication Tips Realized that how we explain matters as much as what we know. Clear, structured answers always stand out. 📌 Trainer’s Advice That Stuck With Me: Knowledge + Communication = Selection Consistent learning, daily practice, and improving explanations step by step. Excited to keep moving forward 💻🔥 #Java #CoreJava #ProgrammingFundamentals #LearningInPublic #InterviewPreparation #TapAcademy #JavaDeveloper #Day5 #Consistency
To view or add a comment, sign in
-
-
💻 Java Basics | Understanding the Structure of a Java Program Today, I revised the basic structure of a Java program and understood how each keyword plays an important role in program execution. 🔹 public This keyword means the class and method are accessible from anywhere. It allows the JVM to access the program from outside the class. 🔹 class The class keyword is used to create a blueprint. In Java, everything runs inside a class, and it defines the type of object being created. 🔹 Class Name (HelloWorld) The class name represents the identity of the program. It should always start with a capital letter and must match the file name. 🔹 main Method The main method is the starting point of any Java program. When the program runs, execution always begins from this method. 🔹 static Keyword Using static allows the JVM to call the main method without creating an object of the class. 🔹 void This means the main method does not return any value. 🔹 String[] args This is an array of strings used to accept command-line arguments while running the program. 🔹 System.out.println() This statement is used to print output on the screen. In this case, it displays “Hello World!”, confirming that the program executed successfully. ✨ Understanding these fundamentals helps in building a strong foundation for advanced Java concepts. #Java #CoreJava #JavaBasics #Programming #LearningJourney #StudentDeveloper Meghana M 10000 Coders
To view or add a comment, sign in
-
-
Unlocking the Power of Standardization in Java ☕ Today's deep dive into Core Java concepts brought me to a crucial topic: Interfaces. I learned that an Interface is essentially a collection of pure abstract methods—method signatures with absolutely no body1. But why do we need them? This infograph provided a perfect example: Imagine three different developers building a calculator. Without rules, one might name their method add(), another addition(), and the third sum(). This inconsistency makes the code difficult for users to navigate. Key Takeaways: ✅ Standardization: Interfaces act as a rulebook. By defining a Calculator interface, every developer is forced to implement the exact same method names (add and sub). ✅ Flexibility: While the method name is enforced, the logic inside can vary. As shown in my practice code, MyCalculator1 can use hardcoded values, while MyCalculator2 uses Scanner for user input—both adhering to the same interface contract. ✅ Syntax: We use the implements keyword to inherit these abstract methods and the @Override annotation to give them life2. Excited to apply this to build cleaner, more scalable applications! 🚀 TAP Academy Sharath R #Java #Coding #SoftwareDevelopment #TapAcademy #LearningJourney #CleanCode
To view or add a comment, sign in
-
-
🌱 Learning Java Collection Framework – Practical Understanding 🌱 Today’s session was all about practical implementation, and honestly it helped me clear many small but important doubts about the Java Collection Framework. We worked on converting Arrays to Collections and Collections back to Arrays, which looks simple but is very important in real coding scenarios. 🔹 Converted Array ➝ List using Arrays.asList() and learned that this list is fixed-size (we cannot add or remove elements). 🔹 To overcome this limitation, I used ArrayList and understood why we prefer it when modification is required. 🔹 Converted Array ➝ Set using HashSet to remove duplicate values automatically — a very useful concept in real-world data handling. 🔹 Practiced Collection ➝ Array conversion using toArray() and understood how type matters while converting. 📌 What I personally learned today: ✔ Why Collection Framework is more flexible than arrays ✔ When to use List and when Set is a better choice ✔ How small implementation details can cause errors if not understood properly Special thanks to Prasoon Bidua Sir for explaining the concepts in such a clear and practical way 🙏 Today’s practice made me realize that understanding concepts + hands-on coding is the real way to improve. Still learning, still improving 💪 #Java #CollectionFramework #ArrayToList #ListToArray #JavaDeveloper #LearningByDoing #CodingPractice #FullStackJava
To view or add a comment, sign in
-
-
Understand the concept of class and object in Java. Learn how to define classes and create objects with practical examples
To view or add a comment, sign in
-
The most ignored line in Java (but the most important one) 👉 Every Java program you’ve ever written starts with this line… but most beginners don’t really understand it: 𝗽𝘂𝗯𝗹𝗶𝗰 𝘀𝘁𝗮𝘁𝗶𝗰 𝘃𝗼𝗶𝗱 𝗺𝗮𝗶𝗻(𝗦𝘁𝗿𝗶𝗻𝗴[] 𝗮𝗿𝗴𝘀) When I was learning Java, I used to write this line from memory. No understanding. Just copy-paste. Until I realized: 👉 This one line decides 𝙝𝙤𝙬 𝙮𝙤𝙪𝙧 𝙚𝙣𝙩𝙞𝙧𝙚 𝙅𝙖𝙫𝙖 𝙥𝙧𝙤𝙜𝙧𝙖𝙢 𝙨𝙩𝙖𝙧𝙩𝙨. Let’s break it simply: 🔹𝙥𝙪𝙗𝙡𝙞𝙘 → Java can access this method from anywhere 🔹 𝙨𝙩𝙖𝙩𝙞𝙘 → No object needed. JVM can call it directly 🔹 𝙫𝙤𝙞𝙙 → It returns nothing 🔹 main → This is the starting point of your program 🔹 𝙎𝙩𝙧𝙞𝙣𝙜[] 𝙖𝙧𝙜𝙨 → Used to take input from the command line In short: This is the 𝗴𝗮𝘁𝗲 through which Java enters your program. Once you truly understand this line, ✔ errors make more sense ✔ execution flow becomes clearer ✔ backend concepts become easier later If you are serious about Java, don’t just memorize — 𝘂𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱. This is Post #1 of my 𝗝𝗮𝘃𝗮 𝗳𝗼𝗿 𝗕𝗲𝗴𝗶𝗻𝗻𝗲𝗿𝘀 𝘀𝗲𝗿𝗶𝗲𝘀. I’ll keep sharing simple, practical Java concepts regularly. 💬 𝗜𝗳 𝘆𝗼𝘂’𝗿𝗲 𝗹𝗲𝗮𝗿𝗻𝗶𝗻𝗴 𝗝𝗮𝘃𝗮, 𝗰𝗼𝗺𝗺𝗲𝗻𝘁 “𝗝𝗔𝗩𝗔” 𝗮𝗻𝗱 𝘁𝗲𝗹𝗹 𝗺𝗲 𝘆𝗼𝘂𝗿 𝗹𝗲𝘃𝗲𝗹 (𝘀𝗰𝗵𝗼𝗼𝗹 / 𝗰𝗼𝗹𝗹𝗲𝗴𝗲 / 𝗯𝗲𝗴𝗶𝗻𝗻𝗲𝗿 / 𝘄𝗼𝗿𝗸𝗶𝗻𝗴 𝗽𝗿𝗼𝗳𝗲𝘀𝘀𝗶𝗼𝗻𝗮𝗹). #Java #JavaBeginners #LearnJava #Programming #ComputerScience #CodingLife #Students #SoftwareEngineering #BackendDevelopment
To view or add a comment, sign in
-
-
I’ve written an article on Java where I explain [brief topic – e.g., Java basics / OOP concepts / memory management] in a simple and practical way. This article is especially useful for beginners and students who are starting their Java journey. 📖 Read here: Java — The Master of Modern Programming https://lnkd.in/ghADQehd I’d love to hear your thoughts and feedback! #Java #Programming #SoftwareDevelopment #LearningJava #MediumArticle
To view or add a comment, sign in
-
Day 10 - 🚀 Increment and Decrement Operators in Java Understanding increment (++) and decrement (--) operators is essential for every Java programmer. These operators are commonly used in loops, counters, and logic-building. 🔹 What are Increment and Decrement Operators? ✅ Increment (++) → Increases a variable’s value by 1 ✅ Decrement (--) → Decreases a variable’s value by 1 🔹 Types of Increment & Decrement Java provides two ways to use these operators: 1️⃣ Pre-Increment / Pre-Decrement The value changes before it is used in an expression. int a = 5; int b = ++a; // a becomes 6, then b = 6 int x = 5; int y = --x; // x becomes 4, then y = 4 📌 First change happens, then assignment. 2️⃣ Post-Increment / Post-Decrement The value is used first, then it changes. int a = 5; int b = a++; // b = 5, then a becomes 6 int x = 5; int y = x--; // y = 5, then x becomes 4 📌 First assignment happens, then change. 🔹 Key Difference at a Glance Operator Meaning When Value Changes ++a Pre-increment Before use a++ Post-increment After use --a Pre-decrement Before use a-- Post-decrement After use 💡 Where are they used? ✔ Loop counters (for, while) ✔ Array indexing ✔ Game scores, timers, and tracking values Mastering these small operators makes your logic cleaner and your code more efficient! 💻✨ #Java #Programming #CodingBasics #JavaLearning #Developers
To view or add a comment, sign in
-
More from this author
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development