✅ The Main Method as the Entry Point of a Program 📍Every program starts execution from the main() method. 📍The Operating System (OS) gives control only to the main() method. 📍This is called the Control of Execution (COE). In Java, the program must be inside a class. ⚡The main method has a specific structure in Java: Java📈 public static void main(String[] args) Each keyword has a specific meaning: public → Accessible to JVM static → No object creation needed void → No return value main → Method name (fixed/compulsory) String[] args → Command line arguments 💻 In C: C👇 #include <stdio.h> void main() { printf("Hello World"); } ☕ In Java: Java👇 public static void main(String[] args) { System.out.println("Hello World"); } #Java #CoreJava #LearningJourney #CodingPractice #ProgrammingBasics #StudentDeveloper #LogicBuilding TAP Academy
Java Main Method: Entry Point of a Program
More Relevant Posts
-
A variable is a container used to store data that can change during the execution of a program. In Java, every variable must have a data type, which defines what kind of data it can store (like int, double, String, etc.). 🔸 Types of Variables in Java 1️⃣ Local Variable A local variable is declared inside a method, constructor, or block. ✔️ Scope: Accessible only within that method/block ✔️ Lifetime: Exists only while the method is executing ✔️ Must be initialized before use 2️⃣ Instance Variable An instance variable is declared inside a class but outside any method. ✔️ Scope: Accessible throughout the class ✔️ Lifetime: Exists as long as the object exists ✔️ Each object has its own copy 🔎 Quick Difference 🔹 Local Variable → Belongs to a method 🔹 Instance Variable → Belongs to an object #Java #Programming #SoftwareDevelopment #Coding #LearningJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 23 of #100DaysOfLeetCode 💻✅ Solved #19. Remove Nth Node From End of List on LeetCode using Java. Approach: • Used a dummy node to handle edge cases (like removing the head) • Initialized two pointers: fast and slow • Moved fast pointer n+1 steps ahead to maintain a gap • Traversed both pointers together until fast reached null • Slow pointer stopped just before the node to delete • Updated links to remove the target node in one pass Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 43.77 MB Key Learning: ✓ Mastered two-pointer (fast & slow) technique ✓ Understood importance of dummy node for edge cases ✓ Solved the problem in a single traversal (O(n) time, O(1) space) Consistency is building confidence 🚀 #Java #LeetCode #DSA #LinkedList #TwoPointers #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
#Day13 – Advanced Strings & Mutable vs Immutable 🤯 Today was all about Advanced String concepts and understanding Mutable vs Immutable in Java. ✔ Difference between immutable and mutable strings ✔ How concat() creates a new object in Heap ✔ How reference update changes output ✔ Difference between String, StringBuffer, and StringBuilder ✔ Initial capacity (16) and dynamic capacity formula (n * 2 + 2) ✔ Methods like length(), charAt(), toCharArray() ✔ Split vs StringTokenizer (why split is recommended) TAP Academy Harshit T #Java #Strings #StringBuilder #StringBuffer #CoreJava #ProgrammingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Built a Concurrent Token Bucket Rate Limiter in Java I recently implemented a thread-safe Rate Limiter Engine using the Token Bucket algorithm in Java to understand how real systems control request bursts and ensure fair usage under concurrent load. This project simulates high concurrent traffic and enforces per-client rate limits using fine-grained locking and concurrent data structures. 🔧 Key Highlights: • Per-client token bucket rate limiting • Thread-safe design • ConcurrentHashMap for client → bucket mapping • ReentrantLock for safe token updates • Lazy refill strategy based on elapsed time (no scheduler thread) • Metrics tracking using AtomicLong counters • ExecutorService thread pool to simulate concurrent requests • Console UI for interactive testing 🧠 What I Focused On: Designing for correctness under concurrency — ensuring: no duplicate bucket creation no race conditions in token consumption parallel processing across different clients serialized access per client 📌 Concepts Used: Java Concurrency, Thread Pools, Locks, Concurrent Collections, Token Bucket Algorithm, Rate Limiting Design I also documented the system design and flow for interview-style explanation. GitHub repo: https://lnkd.in/gtwGzqtC Open to feedback and suggestions for improving this toward a distributed (Redis-based) rate limiter. #Java #Backend #SystemDesign #Concurrency #RateLimiting #TokenBucket #GitHubProjects
To view or add a comment, sign in
-
Day 20 of #100DaysOfLeetCode 💻✅ Solved #21. Merge Two Sorted Lists problem on LeetCode in Java. Approach: • Handled edge cases where either list is empty • Used a dummy node to simplify merging logic • Maintained a pointer current to build the new list step-by-step • Compared nodes from both lists and linked the smaller one • Connected any remaining nodes after one list ends • Returned dummy.next as the new head of the merged list Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 44.26 MB (Beats 75% submissions) Key Learning: ✓ Strengthened understanding of linked list pointer manipulation ✓ Learned to merge two lists without creating extra nodes ✓ Improved confidence in multi-pointer problems and list traversal Learning one problem every single day 🚀 #Java #LeetCode #DSA #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
I just completed an intensive session focused on the core of Java's efficiency: Immutable Strings and Memory Management. While we often use strings daily, understanding what happens under the hood is what separates a coder from a developer. Key Takeaways from the session: The Power of Command Line Arguments: We explored how the String[] args in the main method actually functions, learning how to pass dynamic data into applications via the CLI—a crucial skill for building professional-grade tools . Strings as Objects: In Java, strings aren't just data; they are objects . I learned the three distinct ways to initialize them: using the new keyword, using string literals, and converting character arrays . Memory Architecture (SCP vs. Heap): This was a game-changer. I now understand that Java optimizes memory by using the String Constant Pool (SCP) for literals to prevent duplicates, while the Heap Area allows for duplicate objects when the new keyword is used . The Comparison Trap: I finally mastered the difference between reference comparison and value comparison. Using == compares the memory address (reference), while the .equals() method compares the actual content . Immutability: We began exploring why certain data, like birthdays or names, are best handled as immutable strings—meaning they cannot be changed once created in memory . I'm looking forward to the next phase of this journey: Object-Oriented Programming (OOP)! . #Java #SoftwareDevelopment #Programming #MemoryManagement #TechLearning #JavaDeveloper #CodingJourney #Tapacadmey
To view or add a comment, sign in
-
-
🚀 Java Revision Journey – Day 02 Continuing my Java revision, today I focused on understanding Methods and Arrays, which are fundamental for writing structured and efficient programs. 📌 Topics Covered: Methods ✔ Introduction to Methods ✔ Static Methods vs Instance Methods ✔ Access Modifiers ✔ Command Line Arguments ✔ Variable Arguments (Varargs) Arrays ✔ Introduction to Arrays ✔ Multi-Dimensional Arrays ✔ Jagged Arrays ✔ Arrays Class ✔ Final Arrays Also completed quizzes on both Methods and Arrays to reinforce the concepts. Consistently revisiting the fundamentals helps strengthen problem-solving skills and improves code structure. #Java #CoreJava #Programming #LearningJourney #BackendDevelopment #day02 #Arrays #Methods
To view or add a comment, sign in
-
Day 21 of #100DaysOfLeetCode 💻✅ Solved #27. Remove Element problem on LeetCode in Java. Approach: • Used a two-pointer technique to modify the array in-place • Maintained a pointer k to place elements not equal to val • Iterated through the array and skipped elements equal to val • Placed non-val elements at the k-th position and incremented k • Returned k as the number of remaining elements Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 44 MB (Beats ~75% submissions) Key Learning: ✓ Strengthened understanding of in-place array manipulation ✓ Learned how to skip unwanted elements efficiently ✓ Improved confidence in two-pointer techniques for array problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 26... 💡Today, I explored a brand new concept — Method Overloading in Java. Here’s a 1-minute recap 🧠👇 🔹 Definition: Method Overloading means defining multiple methods with the same name in a class, but with different parameter lists (number or type). 🔹 How Java Resolves It: At compile time, the Java compiler checks: 1️⃣ Method name 2️⃣ Number of parameters 3️⃣ Type of parameters …and calls the correct version — avoiding any confusion. 🔹 Key Insight: No method is truly “overloaded.” Each method performs its own unique task — we, as programmers, just assume one name does many things. 🔹 Why Called Compile-Time Polymorphism? Because the method to be executed is decided at compile time. 🔹 Polymorphism in Simple Words: “One in many forms.” Example: Water 💧 Ice ❄️ → Solid Water 💦 → Liquid Steam ☁️ → Gas That’s polymorphism — and method overloading is its compile-time version! #Java #Learning #Polymorphism #MethodOverloading #JavaDeveloper #CodingJourney
To view or add a comment, sign in
-
-
✨DAY-23: 💡 Understanding Functional Interfaces in Java – Made Simple with Real-Life Examples! Sometimes, the best way to understand Java concepts is to connect them with real-world scenarios. This meme perfectly explains three important functional interfaces in Java: ✅ Predicate – Just like checking an ID to verify if someone is above 21. It takes input and returns true or false. ✅ Consumer – Like receiving and eating a pizza 🍕. It takes input and performs an action, but returns nothing. ✅ Supplier – Like a warehouse worker delivering new supplies. It doesn’t take input, but it supplies data when needed. Functional interfaces are the backbone of Lambda Expressions and the Stream API in Java. When we relate them to daily life, the concepts become much easier to understand and remember. 📌 Java becomes powerful when theory meets real-world thinking! #Java #FunctionalInterfaces #Java8 #LambdaExpressions #Programming #CodingLife
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