Continuing My Core Java Learning Journey — Understanding the Main Method Today’s session at Tap Academy focused on one of the most fundamental concepts in Java — the main method, which serves as the entry point of every Java program. What is the Main Method? - The main method is the starting point from where the Java Virtual Machine (JVM) begins program execution. Without a main method, a standard Java application cannot run. - Every method in Java must be defined inside a class, and the main method is no exception. - Standard Syntax of Main Method public static void main(String[] args) Let’s understand each keyword: - public — Makes the method accessible to the JVM from outside the class, allowing it to be executed. - static — Allows the method to be called without creating an object of the class. The JVM can directly invoke it. - void — Indicates that the method does not return any value. - main — The predefined name recognized by the JVM as the entry point. - String[] args — Used to accept command-line arguments during program execution. 💻 Why is the Main Method Important? - Acts as the starting point of program execution - Provides structure for running Java applications - Allows passing inputs through command-line arguments Valid Ways to Write the Main Method in Java Java allows some flexibility in writing the main method: - public static void main(String[] args) - public static void main(String args[]) - public static void main(String... args) All of these are valid because they represent an array of Strings. Learning these fundamentals is helping me understand how Java programs actually start and execute behind the scenes. Excited to continue building stronger Core Java foundations! #Java #CoreJava #ProgrammingBasics #LearningJourney #SoftwareDevelopment #TapAcademy #JavaDeveloper
Java Main Method Fundamentals
More Relevant Posts
-
🚀 Day 20 | Core Java Learning Journey 📌 Topic: Exception Handling in Java Today, I learned one of the most important concepts for building robust Java applications — Exception Handling. Exception handling helps prevent program crashes and allows graceful error management. 🔹 What is an Exception? ▪ An Exception is an unexpected event that disrupts the normal flow of a program ▪ Occurs during runtime (not during normal execution) ▪ Represented as objects in Java ▪ All exceptions are derived from the Throwable class 👉 Hierarchy (Important Concept): ✔️ Error (Serious system problems) ✔️ Exception (Application-level issues) 🔹 Types of Exceptions in Java ✔️ 1. Checked Exceptions (Compile-Time Exceptions) ▪ Checked at compile time ▪ Must be handled using try-catch or throws ▪ Example: IOException, SQLException, ClassNotFoundException ✔️ 2. Unchecked Exceptions (Runtime Exceptions) ▪ Occur during runtime ▪ Not mandatory to handle ▪ Caused mostly by programming mistakes Examples: ▪ NullPointerException ▪ ArithmeticException ▪ ArrayIndexOutOfBoundsException ▪ NumberFormatException ▪ IllegalArgumentException 🔹 Exception Handling Syntax try { // Risky code (may cause exception) } catch (ExceptionClassName ref) { // Handling code (alternate flow) } 📌 Simple Explanation: ✔️ try block → Contains code that may generate exception ✔️ catch block → Handles the exception ✔️ Program does not terminate abruptly ✔️ Multiple catch blocks are allowed 🔹 Important Keywords in Exception Handling ✔️ try → Wrap risky code ✔️ catch → Handle exception ✔️ finally → Always executes (cleanup code) ✔️ throw → Explicitly throw exception ✔️ throws → Declare exception responsibility 🔹 Advantages of Exception Handling ✔️ Prevents abnormal program termination ✔️ Maintains normal application flow ✔️ Helps debugging & error tracking ✔️ Improves code reliability ✔️ Enables graceful recovery 📌 Key Takeaway ✔️ Exceptions are objects in Java ✔️ Handled using try-catch blocks ✔️ Checked vs Unchecked is crucial concept ✔️ Proper handling = Stable & Safe Applications Exception handling is essential for writing production-ready Java code 💡 Special thanks to Vaibhav Barde Sir for the clear explanations 🚀💻 #CoreJava #JavaLearning #ExceptionHandling #OOP #JavaDeveloper #LearningJourney
To view or add a comment, sign in
-
-
🚀 Learning Update – Java Static & Inheritance Concepts Today’s session helped me understand some very important Java concepts that play a big role in writing efficient and structured programs. 🔹 Static Variables Static variables belong to the class rather than objects. This means only one copy of the variable exists, regardless of how many objects are created. This helps in efficient memory utilization, especially when a value is common for all objects (for example, a common interest rate in a banking application or the value of π in calculations). 🔹 Static Block A static block is used to initialize static variables and execute code before the main method runs. It is useful when some setup needs to happen as soon as the class is loaded. 🔹 Static Methods Static methods can be called without creating an object of the class. They are useful when a method does not depend on object data, such as a utility method for converting miles to kilometers. 🔹 Understanding Java Execution Flow One interesting thing I learned is that Java program execution starts with: Static Variables → Static Blocks → Main Method. 🔹 Introduction to Inheritance We also started learning about Inheritance, one of the core pillars of Object-Oriented Programming. Inheritance allows one class to acquire properties and behaviors of another class, which helps in: • Code reusability • Reduced development time • Better maintainability For example, a child class can inherit features from a parent class using the extends keyword. 📚 Concepts like these make me appreciate how Java is designed to promote efficient memory usage, reusable code, and structured programming. Excited to continue learning more about different types of inheritance and real-world implementations in Java. 💻 #Java #CoreJava #ObjectOrientedProgramming #OOP #Programming #LearningJourney #SoftwareDevelopment @TAP Academy
To view or add a comment, sign in
-
-
🌟 Day 15 – Java Learning at TAP Academy: Strings Uncovered! 🌟 Today, I dove deep into Java Strings – one of the most subtle yet crucial topics in Java programming. Here’s a quick recap of what I learned: 💡 What’s a String? A sequence of characters in double quotes, but remember – in Java, Strings are objects, not primitives. Immutable by default! 🛠 Creating Strings 1️⃣ new String("Java") → Heap memory, duplicates allowed 2️⃣ "Java" → String Constant Pool, duplicates NOT allowed 3️⃣ From char[] → Heap memory, duplicates allowed 🧠 Memory Insights "Java" == "Java" → true (same pool object) new String("Java") == new String("Java") → false (different heap objects) Always use .equals() for value comparison 🔍 Comparing Strings == → reference comparison .equals() → case-sensitive value comparison .equalsIgnoreCase() → ignore case .compareTo() → lexicographical order ➕ Concatenation Rules + with literals → Pool (reuse) + with references → Heap .concat() → Always Heap (immutable strings, original unchanged) 🎯 Key Takeaways Pool = no duplicates, Heap = duplicates allowed Avoid == for values Concatenation behaves differently based on literals vs variables 💻 Practice Tip: Test scenarios like "A" vs new String("A"), + with literals & references to really internalize memory behavior. Learning Java is like exploring a layered maze – every day brings new insights! 🚀 #Java #StringInJava #TAPAcademy #Day15 #ProgrammingJourney #CodingTips #ImmutableStrings #JavaLearning
To view or add a comment, sign in
-
-
🚀 Day 21 | Core Java Learning Journey 📌 Topic: Exception Handling Keywords in Java Today I learned the most important Java exception handling keywords: try, catch, finally, throw, throws — and the commonly confused finalize(). Understanding them is essential for writing clean, production-ready Java code 💡 🔹 try ✔ Wraps risky code ✔ Must be followed by catch or finally ✔ Cannot exist alone ✔ Multiple catch blocks allowed Syntax : try { // risky code } catch(Exception e) { // handling } 🔹 catch ✔ Handles exceptions from try ✔ Takes exception object as parameter ✔ Order matters (Child → Parent) ✔ Multiple catch blocks allowed 🔹 finally ✔ Always executes (whether exception occurs or not) ✔ Executes even if return statement is present ✔ Used for cleanup (files, DB, etc.) ✔ Won’t execute only if JVM crashes or System.exit() is called 🔹 throw ✔ Explicitly throws an exception ✔ Used inside method body ✔ Can throw checked & unchecked exceptions ✔ Followed by exception object throw new IllegalArgumentException("Invalid Age"); 🔹 throws ✔ Declares exception responsibility ✔ Used in method signature ✔ Mainly for checked exceptions ✔ Can declare multiple exceptions public void readFile() throws IOException { // code } 🔥 throw vs throws ✔ throw → Inside method body ✔ throws → In method declaration ✔ throw → Single exception ✔ throws → Multiple exceptions 🔹 finalize() (Important) ✔ NOT part of exception handling ✔ Belongs to Garbage Collection ✔ Defined in Object class ✔ Called before object destruction ✔ Deprecated (Java 9+) 🔥 finally vs finalize() ✔ finally → Exception handling block ✔ finalize() → GC method ✔ finally → (Almost) always runs ✔ finalize() → May or may not run 📌 Key Takeaways ✔ finally ensures cleanup ✔ throw creates exceptions ✔ throws delegates responsibility ✔ finalize() relates to memory management Small keywords — powerful concepts 💻🚀 Special thanks to Vaibhav Barde Sir . #CoreJava #JavaLearning #ExceptionHandling #JavaDeveloper #OOP #LearningJourney
To view or add a comment, sign in
-
-
🚀Day 44 – Java Full Stack Learning with Frontlines EduTech (FLM) & Fayaz S. Today, I explored Java 8, which was introduced in 2014. Java 8 brought many important improvements to the language and made coding simpler and more readable. It introduced several new features that support functional-style programming and help reduce boilerplate code. 🔹 Functional Interface A Functional Interface is an interface that contains only one abstract method. It can have multiple default or static methods, but only one abstract method. We can use the @FunctionalInterface annotation to indicate that the interface is functional. This annotation is not mandatory, but it is recommended because it prevents accidental addition of extra abstract methods. Example: @FunctionalInterface interface MyFunctionalInterface { void display(); } 🔹 Default Method Java 8 introduced the default method feature, which allows us to write method implementation inside an interface. To define a default method: • The default keyword is mandatory • We can provide a method body inside the interface • It is not mandatory for the implementing class to override it Example: interface MyInterface { default void show() { System.out.println("This is a default method"); } } class Test implements MyInterface { public static void main(String[] args) { Test obj = new Test(); obj.show(); } } Here, the Test class can directly use the default method without overriding it. Today, I strengthened my understanding of Java 8 features, especially Functional Interfaces and Default Methods, and how they improve code flexibility and reusability. 🚀📈 #Java #JavaFeatures #JavaFullStack #FrontlinesEduTech #FullStackDeveloper #JavaDeveloper
To view or add a comment, sign in
-
🚀 Day 16 | Core Java Learning Journey 📌 Topic: this, super & final Keyword (Java Keywords – Part 2) Today, I explored three very important Java keywords that control object behavior, inheritance, and immutability. 🔹 this Keyword in Java 1️⃣ this Variable ▪ Refers to the current object ▪ Used to resolve variable name conflicts ▪ Helps initialize instance variables 2️⃣ this Method ▪ Calls another method of the same class ▪ Improves readability & clarity 3️⃣ this Constructor ▪ Invokes another constructor in the same class ▪ Enables Constructor Chaining (important concept) ▪ Must be the first statement in constructor 🔹 super Keyword in Java (Used in Inheritance) 1️⃣ super Variable ▪ Refers to parent class variables ▪ Used when parent & child share same field names 2️⃣ super Method ▪ Calls parent class methods ▪ Useful when method is overridden 3️⃣ super Constructor ▪ Invokes parent class constructor ▪ Must be first statement in constructor ▪ If not written, compiler adds it automatically 🔹 final Keyword in Java 1️⃣ final Variable ▪ Value cannot be changed once assigned ▪ Used to create constants 2️⃣ final Method ▪ Cannot be overridden ▪ Ensures method behavior remains fixed 3️⃣ final Class ▪ Cannot be inherited ▪ Prevents extension 📌 Key Takeaway ✔️ this → Refers to current object / constructor chaining ✔️ super → Access parent class members ✔️ final → Restricts modification & inheritance Special thanks to Vaibhav Barde Sir for the clear explanations 🚀💻 #CoreJava #JavaLearning #OOP #ThisKeyword #SuperKeyword #FinalKeyword #JavaDeveloper #LearningJourney
To view or add a comment, sign in
-
-
🚀 Understanding Constructors in Java – Learning at Tap Academy In today’s session at Tap Academy, I deepened my understanding of one of the most important concepts in Java – Constructors. 🔹 What is a Constructor? A constructor is a specialized method in Java that is automatically invoked during object creation. It is mainly used to initialize instance variables of a class. In simple words, a constructor acts like a specialized setter that assigns values to the object at the time of creation. 🔹 Key Rules of a Constructor ✔ The constructor name must be the same as the class name. ✔ It does not have a return type (not even void). ✔ It is automatically called when an object is created using the new keyword. 🔹 Default Constructor If a programmer does not create any constructor, Java automatically provides a default constructor. The default constructor: Has no parameters Assigns default values to instance variables This ensures that object creation is always possible. 🔹 Parameterized Constructor & Shadowing Problem When we create a constructor with parameters, usually the parameter names are kept the same as the instance variable names for clarity. Example concept: class Student { int id; Student(int id) { id = id; // Shadowing problem } } Here, the local variable (parameter) and the instance variable have the same name. This creates a situation called the Shadowing Problem, where the local variable hides the instance variable. 🔹 Resolving Shadowing Using this Keyword To resolve this, we use the this keyword. this refers to the current object’s instance variable. Correct approach: Student(int id) { this.id = id; } Here: this.id → refers to the instance variable id → refers to the local variable (parameter) Using this, we can correctly assign the local variable value to the instance variable. 🔹 Key Takeaways ✅ Constructors initialize objects ✅ Constructor name must match the class name ✅ Java provides a default constructor if none is written ✅ Shadowing occurs when local and instance variables share the same name ✅ this keyword resolves shadowing Grateful to Tap Academy for breaking down core Java concepts in such a clear and practical way. #Java #OOPS #Constructors #LearningJourney #TapAcademy #Programming #SoftwareDevelopment TAP Academy
To view or add a comment, sign in
-
-
🚀 Day 15 – Core Java Training TAP Academy Academy | Methods (All 4 Types) + Parameters vs Arguments + Stack/Heap Trace 💻🧠 Good afternoon everyone! 🌟 Today’s session was not only about writing methods… it was about thinking like a developer — understanding how code executes inside memory and why methods are the backbone of Java ✅🔥 ✅ What I Learned Today 🧩 1) Methods = Code Reusability (Real Meaning) ♻️ We revised that methods help us avoid rewriting logic again & again. ✅ Write once → Call multiple times → Save time + clean code 💯 🏗️ 2) 4 Types of Methods (Complete Revision) ✅✅ Today we revised all method variations clearly: 1️⃣ No Input – No Output (void) 2️⃣ No Input – Output (return type) 3️⃣ Input – No Output (parameters + void) 4️⃣ Input – Output (parameters + return) 🔥 🧠 3) Method Structure (Very Important) 🧾 A method contains: ✅ Access Modifier (public / default etc.) ✅ Return Type (void / int / float…) ✅ Method Name ✅ Parameters (inside brackets) ✅ Method Body (logic inside { }) 🔁 4) Parameters vs Arguments (Interview Terminology) 🎯 This was a key learning 💡 ✅ Parameters → What the method accepts (method signature) ✅ Arguments → What we pass while calling the method 📌 Developers use these terms a lot in interviews — now I can speak correctly ✅💬 🧠 5) Execution in Memory (Stack + Heap Trace) 🔥 We traced the program execution step-by-step: 🧱 Stack Segment ✅ Main stack frame loads first ✅ Calling a method pushes a new stack frame ✅ Follows LIFO (Last In First Out) 🏗️ Heap Segment ✅ Objects are created in heap ✅ Instance variables stay inside the object ✅ If no reference → becomes garbage ♻️ ✅ Garbage Collector cleans automatically ✅ 🧾 6) Pass By Value Reminder (Connecting the Dots) 🔗 When passing primitive values (like int): ✅ Value is copied → changes inside method won’t affect original variable This helped me connect how methods + memory + parameters work together 💡 ⭐ 7) Best Practical Example: Pattern Printing with Methods 🌟 We used methods to print patterns once and call it multiple times with different inputs ✅ 📌 This proved real code reduction + reusability in action 🚀 🎯 Key Takeaway 💡 ✅ Writing code is easy… 🔥 Understanding execution + memory + method flow is what builds real Java developers 💪💻 ✅ Task for Me 📌 🎯 Complete Methods section (8 problems) in the TAI Portal today itself 💪📚 Trainer:Sharath R #TapAcademy #CoreJava #JavaMethods #Programming #JavaDeveloper #LearningJourney #StackAndHeap #GarbageCollector #CodingPractice #Freshers #SoftwareDevelopment 🚀🔥
To view or add a comment, sign in
-
-
🚀 Java Learning Journey – Understanding Core Concepts Today at Tap Academy, I strengthened my Java fundamentals by learning some important differences that every Java developer must know! 💻✨ 🔹 1️⃣ Difference Between this Keyword and this() Method 👉 this Keyword Refers to the current object of the class. Used to differentiate instance variables from local variables. Can be used to call current class methods. class Student { String name; Student(String name){ this.name = name; // Refers to instance variable } } 👉 this() Method Used to call another constructor in the same class. Must be the first statement inside the constructor. class Student { Student(){ this("Navya"); // Calls parameterized constructor } Student(String name){ System.out.println(name); } } 📌 Key Difference: this → Refers to current object this() → Calls another constructor 🔹 2️⃣ Difference Between Constructor and Method Constructor 🏗 Method ⚙ Used to initialize objects Used to define behavior Same name as class Any valid name No return type Must have return type Called automatically Called explicitly 📌 Example: class Demo { Demo(){ // Constructor System.out.println("Constructor called"); } void display(){ // Method System.out.println("Method called"); } } Every small concept builds a strong foundation! 💪 #TAPAcademy #SharathR #Java #FullStackDeveloper #LearningJourney #OOPS #JavaDeveloper #TapAcademy #Programming #CodingLife
To view or add a comment, sign in
-
-
Java Full Stack Development – Day 13 | Tap Academy Topic Covered: 🔹 Pass by Value vs Pass by Reference 🔹 Different Types of Methods in Java 🔹 Memory Segments in Java (Stack, Heap, Static) 1️⃣ Pass by Value ✔ In Java, primitive variables are passed by value. ✔ A copy of the variable is sent to the method. ✔ Changes inside the method do not affect the original value. Example: int a = 1000; int b; b = a; System.out.println(a); System.out.println(b); Output 1000 1000 2️⃣ Pass by Reference (Objects) ✔ Object reference is passed to methods. ✔ Changes made to the object affect the original object. Example: Car c1 = new Car(); c1.name = "MARUTHI"; c1.noOfSeats = 5; c1.cost = 8.66f; System.out.println(c1.name); System.out.println(c1.noOfSeats); System.out.println(c1.cost); Output MARUTHI 5 8.66 3️⃣ Different Types of Methods Java methods are classified into 4 types: 1️⃣ No Input – No Output 2️⃣ No Input – Output 3️⃣ Input – No Output 4️⃣ Input – Output These help in structuring programs and improving code reusability. 4️⃣ Memory Segments in Java Java uses different memory areas: Static Segment • Stores static variables. Stack Segment • Stores method calls and local variables. • Each method has its own stack frame. Heap Segment • Stores objects created using new. Example Concept: class Calculator { int a = 50; int b = 40; void add() { int c = a + b; System.out.println(c); } } ✔ Object stored in Heap ✔ Method execution stored in Stack Conclusion Today’s session helped in understanding how Java handles data passing, method types, and memory management, which are fundamental concepts for becoming a strong Java Full Stack Developer. #Java #JavaFullStack #TapAcademy #Programming #JavaDeveloper #CodingJourney #LearnJava #FullStackDeveloper #SoftwareDevelopment #JavaLearning
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