Java Learning Journey – Day 7 Today I practiced an important concept in Java — Decision Making using If-Else and Switch Statements. These statements help a program choose different actions based on conditions. 🔹 If-Else Statement Used when a program needs to check a condition and execute different blocks of code. Example: if (temp > 30) { System.out.println("It's hot!"); } else { System.out.println("It's not hot."); } 🔹 Switch Statement Used when there are multiple possible cases for a single value. Example: switch(day) { case 1: System.out.println("Monday"); break; case 2: System.out.println("Tuesday"); break; default: System.out.println("Invalid day"); } 💡 Why this is important? Because real-world programs constantly make decisions based on conditions. Learning step by step and strengthening my Java programming fundamentals every day. If you're learning Java or working in development, feel free to connect and share your journey. 🤝 #Java #JavaDeveloper #Programming #CodingJourney #SoftwareDevelopment #LearnJava #Hariom #HariomKumar
Java Decision Making with If-Else and Switch Statements
More Relevant Posts
-
Java Learning Journey – Day 9 Today I learned an important concept in Java — Methods. A method is a block of code that performs a specific task. It helps make code organized, reusable, and easier to maintain. 🔹 Basic Structure of a Method public void greet() { System.out.println("Hello!"); } Here: • public → Access modifier • void → Return type • greet() → Method name • {} → Method body 🔹 Example of a Method with Parameters public int add(int a, int b) { return a + b; } 🔹 Calling a Method greet(); int sum = add(5, 10); 💡 Key Learning: Methods allow developers to break programs into smaller reusable pieces, making programs cleaner and easier to manage. Continuing my journey to become a better Java developer step by step. If you're also learning Java or working in development, let’s connect and grow together. 🤝 #Java #JavaDeveloper #Programming #CodingJourney #SoftwareDevelopment #LearnJava #Hariom #HariomKumar
To view or add a comment, sign in
-
-
🚀 Strengthening my Java fundamentals step by step! Today’s learning was all about Exception Handling in Java, and I explored some powerful concepts: 🔹 Understanding exceptions and stack trace flow 🔹 How JVM handles exceptions internally 🔹 Using try-catch to prevent application crashes 🔹 Concept of exception propagation (method-to-method flow) 💡 Advanced concepts I learned: ✔️ Rethrowing exceptions using throw ✔️ Giving warnings using throws ✔️ Ensuring execution using finally ✔️ Ducking an exception (passing responsibility to caller) 🎯 Key takeaway: 👉 “A well-handled exception ensures smooth program execution without abrupt termination.” The real-world analogies like ATM systems and method calling made the concepts much easier to understand! 📈 Step by step, I can clearly see my improvement in problem-solving and Java fundamentals. #TapAcademy #Java #Programming #ExceptionHandling #CodingJourney #LearningEveryday #FullStackDeveloper
To view or add a comment, sign in
-
-
📘 Back to Learning Java – Rules of Method Overloading After a short break of a week, I started learning again and today’s focus was on Rules of Method Overloading, beginning with the first rule: Access Modifiers. 🔹 Access Modifiers are used to modify the accessibility (visibility) of variables and methods. We learned the four types of access modifiers in Java: 1️⃣ Public ✔ Can be used in the same class ✔ Different class in the same package ✔ Different package (with and without inheritance) 2️⃣ Protected ✔ Can be used in the same class ✔ Different class in the same package ✔ Different package (only if it is inherited) 3️⃣ Package (Default) ✔ Can be used in the same class ✔ Same package 4️⃣ Private ✔ Can be used only inside the same class ❌ Cannot be inherited or accessed outside the class 💡 To understand this better, we created multiple packages and classes and tested how each access modifier behaves in different scenarios. 🔎 Key Conclusion: If you use access modifiers from bottom → top, the accessibility/visibility increases. private → package → protected → public If you use them from top → bottom, the visibility decreases. Always interesting to see how these concepts work practically while coding! 💻 #Java #LearningJava #AccessModifiers #Programming #CodingJourney #SoftwareDevelopment
To view or add a comment, sign in
-
-
🚀 Day 7 of My Java Learning Journey Today I learned about Control Flow Statements in Java, focusing on Conditional Statements. 📌 These statements help control the flow of execution based on conditions. 🔹 Types of Conditional Statements I Covered: 🔸 1. if Statement Executes code only if condition is true 🔸 2. if-else Statement Executes one block if true, another if false 🔸 3. else-if Ladder Used to check multiple conditions 🔸 4. Nested if if statement inside another if 💡 Example: int marks = 75; if(marks >= 80){ System.out.println("Excellent"); } else if(marks >= 50){ System.out.println("Pass"); } else { System.out.println("Fail"); } Understanding these concepts is very important for building logic in real-world applications. Building consistency step by step 💪 🔗 Check my code here: https://lnkd.in/gDP4A9r6 If you are also learning Java, let’s connect and grow together 🤝 #Java #JavaDeveloper #Programming #CodingJourney #LearningInPublic #SoftwareDevelopment
To view or add a comment, sign in
-
-
Day-02/100 of Learning Java-Language: #Question-02: Write a Java Program to Print "Hello World!" ? Ans: Brief: >>> This Java program prints the message “Hello, World!” to the console and is typically the first program written by beginners. It demonstrates the basic structure of a Java application. The program starts with a class declaration named Main, which is required because every Java program must be inside a class. The main method is the entry point of the program where execution begins. It has a specific signature that the Java Virtual Machine (JVM) recognizes. Inside the main method, System.out.println() is used to display output on the screen. This program helps learners understand how Java code is written, compiled, and executed. It builds a strong foundation for learning more advanced concepts in Java programming and software development...
To view or add a comment, sign in
-
-
📚 Day 18 of My Java Learning Journey Today I explored some important Core Java concepts that help write efficient and optimized code. 🔹 StringBuffer • Default capacity is 16 • Mutable – values can be modified without creating a new object • Thread-safe because it uses synchronization • Capacity increases using: (currentCapacity × 2) + 2 🔹 StringBuilder • Similar to StringBuffer but not thread-safe • Faster performance in single-threaded applications 🔹 StringTokenizer • Used to split strings into tokens • Important methods: "hasMoreTokens()" and "nextToken()" 🔹 Method Overloading • Multiple methods with the same name but different parameters • Also called Compile-Time Polymorphism Every day I'm learning something new and improving my Java programming skills. 💻 #Day18 #JavaLearning #ProgrammingJourney #CoreJava #Coding@Tap academy
To view or add a comment, sign in
-
-
Java Input/Output Journey – Day 1 Starting a new phase in my Java learning — Input & Output Basics 💻 🔹 What I Learned Today: • How to take user input using Scanner class • Reading different data types like String, int, double • Writing simple and interactive Java programs 🔹 Key Methods: • nextLine() → Full text input • nextInt() → Integer input • nextDouble() → Decimal input • next() → Single word 💡 Key Learning: Understanding input is the first step to making programs interactive and user-friendly. 🛠️ Practice Done: Created a program to take name, age, and favorite language from the user. Excited to continue this journey and explore more in Java I/O #Java #JavaDeveloper #CodingJourney #InputOutput #Programming #SoftwareDevelopment #Learning #Hariom #HariomKumar #Hariomcse
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
-
🚀 Starting My Java Learning Journey – Day 9 🔹 Topic: Method Overloading in Java Method Overloading is a feature in Java that allows a class to have multiple methods with the same name but different parameters. It helps improve code readability and flexibility. 📌 Ways to Achieve Method Overloading 1️⃣ Different number of parameters 2️⃣ Different data types of parameters 📌 Example Program public class Main { // Method with two int parameters static int add(int a, int b) { return a + b; } // Method with three int parameters static int add(int a, int b, int c) { return a + b + c; } public static void main(String[] args) { System.out.println(add(5, 10)); System.out.println(add(5, 10, 15)); } } Output: 15 30 💡 Key Points: ✔ Method overloading allows multiple methods with the same name ✔ Methods must differ in number or type of parameters ✔ Helps make programs more flexible and readable #Java #JavaLearning #Programming #BackendDevelopment #CodingJourney #MethodOverloading
To view or add a comment, sign in
-
🚀 Day 19/45 – Learning Exception Handling in Java On Day 19 of my Java learning journey, I explored Exception Handling, which is used to handle errors and prevent programs from crashing.This concept is very important for building robust and reliable applications. 📚 What I Learned Today Today I learned: ✔ What exceptions are and why they occur ✔ Using try and catch blocks to handle errors ✔ The role of the finally block ✔ Common types of exceptions in Java 💻 Practice Work To apply my learning, I implemented: • A divide-by-zero exception handling program • An array index error handling example 🎯 Key Takeaway Exception handling ensures that programs run smoothly even when errors occur. It improves the stability and reliability of applications. Understanding how to handle errors properly is a key skill for every developer. #Java #Programming #LearningInPublic #CodingJourney #SoftwareDevelopment #OOP
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