Day 12 – Learning Java Full Stack. Today’s topic was one of the most important concepts in Java — Methods. A method is a named block of reusable code that performs a specific task. Instead of writing the same logic again and again, we can define it once and call it whenever needed. Structure of a Method- Creating a method involves two parts: 1️⃣ Method Declaration 2️⃣ Method Definition General Syntax: access_modifier modifier return_type methodName(arguments) { // method body } Key Points to Learn: A method must be declared inside a class A method executes only when it is called The same method can be called multiple times A class can contain multiple methods Methods improve modularity and reusability They make programs easier to read, maintain, and modify. 📌 Key Takeaway: Methods are the foundation of structured programming. Without methods, building scalable applications would be difficult. #Java #JavaFullStack #MethodsInJava #ProgrammingBasics #LearningInPublic #CoreJava
Java Methods: Reusable Code Blocks for Scalable Apps
More Relevant Posts
-
🚀 Learning Java the Right Way Today, I practiced an important Java concept 👉 Exception Handling. 📌 Problem: Create a Java program that performs division and properly handles the case when a user tries to divide a number by zero. Instead of letting the program crash, I used try–catch–finally blocks to manage the error gracefully. 🔹 Key Learning: try → Code that may cause an exception catch → Handles the exception (like Arithmetic Exception) finally → Executes important code regardless of exception Example scenario: If a user enters 0 as the divisor, Java throws an Arithmetic Exception, which can be handled to prevent program failure. This concept helped me understand: ✔ Runtime error handling ✔ Writing safer and more reliable programs ✔ Improving application stability Proper exception handling is essential for building robust and production-ready software. 📌 Write safe code • Handle errors smartly • Build reliable applications 💡 #java #javafullstack #javadeveloper #corejava #codingjourney #coding
To view or add a comment, sign in
-
-
🚀 Day 4 of My Java Learning Journey Today I learned how a Java program works internally and covered some important core concepts. 📌 Topics I Covered: 🔹 How to run a Java program • Compile using javac • Run using java • JVM executes the program 🔹 Main Method in Java public static void main(String[] args) • public → JVM can access it from anywhere • static → No need to create object • void → Does not return any value • main → Entry point of program 🔹 System.out.println() • System → class from java.lang package • out → object of PrintStream • println() → method used to print output 🔹 Variables in Java • A variable is a container to store data in memory (RAM) • Syntax: datatype variable_name = value; Example: int age = 35; System.out.println("The age is: " + age); 📌 Rules of Variables • Cannot contain spaces • Cannot start with a digit • Can use _ and $ symbols Building strong fundamentals in Java step by step and staying consistent every day. You can check my code here 👇 🔗 https://lnkd.in/gDP4A9r6 If you are also learning Java, let’s connect and grow together 🤝 #Java #JavaDeveloper #CodingJourney #Programming #LearningInPublic #SoftwareDevelopment
To view or add a comment, sign in
-
-
🌱 Learning the Basics of OOP in Java While learning Java, I understood that Object-Oriented Programming (OOP) is built on 4 simple but powerful concepts: 🔹 1. Inheritance One class can use properties and methods of another class. 👉 This helps in reusing code. 🔹 2. Encapsulation Keeping data safe by wrapping variables and methods inside a class. 👉 We use private variables and getters/setters for security. 🔹 3. Polymorphism One method can behave differently in different situations. 👉 Example: Method overloading and method overriding. 🔹 4. Abstraction Showing only important details and hiding internal implementation. 👉 Done using abstract classes and interfaces. Understanding these concepts makes Java much clearer and helps in building real-world applications. I’m currently improving my Java fundamentals step by step. Every small concept I learn gives me more confidence. 💪 #Java #OOP #ProgrammingBasics #LearningJava #BeginnerDeveloper #SoftwareDevelopment
To view or add a comment, sign in
-
-
🚀 Learning Java the Right Way Today, I explored an important concept in Exception Handling 👉 Difference between throw and throws in Java. At first, both keywords looked similar, but understanding their roles made things much clearer. 🔹 throw Used to explicitly throw an exception Written inside the method Used for custom or manual exception handling Example: throw new Exception("Error occurred"); 🔹 throws Used to declare exceptions Written in the method signature Informs the caller that an exception may occur Example: void method() throws IO Exception 📌 Key Learning: throw is used to create an exception throws is used to declare an exception This concept helped me understand: ✔ Better exception flow ✔ Method-level error handling ✔ Writing clean and maintainable code Understanding small differences like this builds strong fundamentals in Java 💪 📌 Learn deeply • Practice consistently • Grow as a developer 🚀 #java #javafullstack #javadeveloper #corejava #codingjourney #coding
To view or add a comment, sign in
-
-
Day 28 -What I Learned in a Day(JAVA) Today I started learning Looping Statements in Java. Loops are used to execute a block of code repeatedly until a certain condition becomes false. They help reduce code repetition and make programs more efficient. In Java, there are mainly three types of loops: • while loop • do-while loop • for loop Today I focused on the while loop. 🔹 What is a While Loop? A while loop executes a block of code repeatedly as long as the condition is true. The condition is checked before the loop executes, so if the condition is false initially, the loop will not run. Syntax of While Loop: initialization; while(condition) { // statements increment / decrement; } What I Practiced Today: ✔ Practiced 3 basic while loop programs ✔ Built a calculator program using while loop and switch statement ✔ Learned how loops control program flow and reduce repetitive code Every day I’m taking small steps to improve my Java programming skills and strengthen my understanding of core concepts. Practiced 👇 #Java #JavaLearning #Programming #CodingJourney #Loops #WhileLoop
To view or add a comment, sign in
-
☕ Java Output Methods Explained – print() vs println() vs \n When learning Java programming, understanding how output works is very important. In the example program, three different output methods are used: 📌 What happens here? ✔ println() → Prints the text and moves the cursor to the next line ✔ print() → Prints the text but stays on the same line ✔ \n → Creates a manual line break (newline character) 💡 Output of this program: Hello World! Hello JishanHii Jishan Because print() does not move to the next line, the second and third outputs appear on the same line. Understanding these small details is essential when learning Java fundamentals and writing clean console output. 🚀 Every Java developer starts with simple programs like this before building large applications. 👉 Question for developers: Do you prefer using println() or \n for line breaks in Java? #Java #JavaProgramming #Coding #Programming #SoftwareDevelopment #BackendDevelopment #JavaDeveloper #LearnJava #ComputerScience #CodingTips
To view or add a comment, sign in
-
-
Day 9 – Java Learning Journey Today I continued strengthening my Java fundamentals, focusing on method overriding and important rules in inheritance. Key concepts I explored: • Method Overriding Rules in Java The child class method must have the same method signature as the parent class method. The return type must be the same or covariant (a subclass of the parent return type). The method cannot be static, because static methods belong to the class rather than the object. • Covariant Return Types Java allows a child class method to return a more specific type than the parent class method, making inheritance more flexible. • Static vs Instance Methods I also learned why static methods cannot be overridden and are instead method hidden, which behaves differently from runtime polymorphism. Step by step, continuing to build a stronger foundation in Core Java and OOP concepts. 🚀 #Java #CoreJava #OOP #MethodOverriding #Programming #SoftwareDevelopment #LearningJourney
To view or add a comment, sign in
-
🚀 Day 7 – Understanding Methods in Java Today I focused on one of the most important concepts in Java — Methods. While it may seem like a basic topic, methods are the foundation of writing clean, reusable, and modular code. 📌 What I Worked On: • Created methods with and without return types • Passed parameters to methods • Returned values using return keyword • Practiced calling methods from the main() method • Built small programs like: Addition of two numbers Even/Odd checker Greeting user using parameters 🔎 Key Learning Outcomes: ✔ Understood how methods improve code reusability ✔ Learned the difference between void methods and value-returning methods ✔ Practiced writing modular code instead of everything inside main() ✔ Strengthened problem-solving by breaking logic into smaller functions This session helped me understand how structured programming works and why modular design is critical in real-world applications. #100DaysOfCode #Java #OOP #ProgrammingFundamentals #JavaDeveloper #SoftwareDevelopment #LearningInPublic #CodeNewbie
To view or add a comment, sign in
-
-
🚀 Starting My Java Learning Journey – Day 8 🔹 Topic: Methods in Java A method is a block of code that performs a specific task. Methods help make programs organized, reusable, and easier to read. returnType – type of value the method returns (use void if it returns nothing) methodName – name of the method parameters – input values the method takes 📌 Example Program public class Main { // Method to add two numbers static int addNumbers(int a, int b) { return a + b; } public static void main(String[] args) { int sum = addNumbers(10, 20); System.out.println("Sum: " + sum); } } Output: Sum: 30 💡 Key Points: Methods avoid code repetition Methods can take inputs (parameters) and return outputs Helps in modular programming #Java #JavaLearning #Programming #BackendDevelopment #CodingJourney #JavaMethods
To view or add a comment, sign in
-
📘 Day 18 of My Java Learning Journey ☕💻 Today I learned about the concept of the main method and method types in Java, which help in writing structured, reusable, and organized programs. 👉 What is a Method? A method is a block of code that performs a specific task. It allows us to reuse code and avoid repetition in a program. 👉 What is Method Signature? A method signature consists of the method name and parameter list. It defines how the method is called. 👉 What is Method Declaration? The declaration specifies the return type, method name, and parameters. 👉 What is Method Definition? The definition contains the actual implementation of the method, where the program logic is written. 👉 Types of Method in Java I practiced today: 1️⃣ With return type and with arguments. 2️⃣ With return type and without arguments. 3️⃣ Without return type and without arguments. 4️⃣ Without return type and with arguments. Understanding the concept of method helps in breaking a program into smaller reusable parts, making the code easier to read and maintain. Step by step, I am strengthening my Java fundamentals. #JavaDeveloper #LearnJava #JavaProgramming #CodingJourney #DailyCoding #DeveloperJourney #CodePractice #ProgrammingLife #TechLearning
To view or add a comment, sign in
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