Today I strengthened my understanding of how Java programs actually execute 🚀☕ Here’s what I learned step by step: ✔ The file name must match the public class name 📄 ✔ The main() method can be inside any class, not only the public class 🔍 ✔ Only one public class is allowed in one ".java" file ⚠️ ✔ Protected members outside the package are accessible through inheritance — 🔹 Non-static → accessed using child class object 🔹 Static → accessed using child class name or parent class name inside child class 👨👦✨ ✔ The JVM first loads the class that contains main(), then loads other required classes when needed 🧠 Understanding these core execution rules is helping me build stronger clarity in Java inheritance and access modifiers 💻📚 #Java #Programming #LearningJourney #OOP #JavaDeveloper #BackendDevelopment 🚀
Java Execution Rules: Main Method and Class Requirements
More Relevant Posts
-
Virtual Threads in Java have made a big chunk of reactive programming… unnecessary. For years, Java developers were told: 👉 “Threads are expensive” 👉 “Use async + non-blocking code” 👉 “Adopt reactive frameworks like WebFlux” And it made sense—platform threads were heavy. Then came Virtual Threads (Project Loom) 🚀 What changed? Virtual threads are: • Lightweight (millions can exist) • Cheap to block • Managed by the JVM, not OS • Too easy to implement. • Scales as required automatically. Bottom line: 👉 Virtual threads bring back straightforward coding 👉 Reactive is now a niche, not a default #java #learn #threads #jdk #programming
To view or add a comment, sign in
-
-
Day 55-What I Learned In a Day (JAVA) Today, I learned how to create and use constructors in Java. 🔹 A constructor is a special method used to initialize an object when it is created. 🔹 Constructors are non-static by default, meaning they work with objects and help assign values to instance variables. 🔹 They are automatically executed when an object is created, making object initialization simple and efficient. 🔹 This reduces the need for setting values manually after object creation. Understanding constructors helped me see how Java initializes objects in a structured and efficient way. #Java #OOP #Constructors #LearningJourney #Programming #TechSkills
To view or add a comment, sign in
-
💻 Day 19 of My Java Journey Today I explored Generics, and it made Java feel much cleaner. Instead of writing separate code for different data types, generics allow us to write one reusable piece of code. Using <T> as a placeholder, we can handle multiple data types safely without worrying about runtime errors. This is one of those concepts that improves both code quality and flexibility. Learning something new every day 🚀 #Java #Programming #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 48 of My Java Learning Journey Today, I explored one of the most important concepts in Java – Collection Framework 💡 📌 What I Learned: Collection Framework is a set of classes and interfaces used to store and manipulate data efficiently It was introduced in JDK 1.2 by Josh Bloch Acts as an alternative to Data Structures in Java 📊 Key Components: Interfaces → List, Set, Queue, Map Classes → ArrayList, LinkedList, HashSet, HashMap 🔥 Why Collections? ✔ Dynamic size (no fixed length like arrays) ✔ Inbuilt methods (add, remove, etc.) ✔ Efficient data handling ✔ Reduces coding effort 💻 Key Features: Allows heterogeneous data Maintains insertion order (List) Allows duplicates (List) Improves performance in real-world applications 📈 Takeaway: Collection Framework is a must-know concept for interviews and real-time development. Almost every Java application uses it! #Day48 #Java #CollectionsFramework #JavaDeveloper #LearningJourney #Coding #Programming
To view or add a comment, sign in
-
-
DAY 32: CORE JAVA 🔐 Understanding Types of Access Modifiers in Java Access modifiers play a crucial role in Object-Oriented Programming (OOP) by controlling the visibility of classes, methods, and variables. They help in achieving encapsulation and securing data from unauthorized access. Here’s a quick breakdown of the main types of access modifiers in Java 👇 🔹 1. Public Accessible from anywhere in the program. 👉 Use when you want a method or variable to be available globally. 🔹 2. Private Accessible only within the same class. 👉 Best for protecting sensitive data and ensuring strict encapsulation. 🔹 3. Protected Accessible within the same package and also by subclasses (even in different packages). 👉 Useful when working with inheritance. 🔹 4. package access modifer Accessible only within the same package. 👉 Acts as a middle ground when you don’t want full public access. 💡 Why are Access Modifiers Important? ✔ Improve code security ✔ Help in maintaining clean architecture ✔ Support data hiding and abstraction ✔ Control how components interact with each other 📌 Pro Tip: Always choose the most restrictive access level possible to make your code more secure and maintainable. TAP Academy #Java #OOP #Programming #Coding #SoftwareDevelopment #Learning #Developers #TechSkills
To view or add a comment, sign in
-
-
🚀 Exploring Java Collection Framework Today’s session was all about understanding the powerful Java Collection Framework and how it helps in managing and organizing data efficiently. Dived deep into core concepts like interfaces and classes in collections, and explored the three main interfaces: List, Set, and Map. Gained clarity on how these structures differ and where to use them in real-world applications. Focused on the ArrayList class—its properties like dynamic resizing, ordered storage, and index-based access—making it one of the most commonly used collection classes in Java. Also understood the hierarchy of ArrayList, how it is part of the List interface, and how it inherits behavior from abstract classes like AbstractList and AbstractCollection. 📚 A strong foundation in collections is essential for writing efficient and scalable Java applications. TAP Academy #Java #CollectionsFramework #ArrayList #Programming #LearningJourney #FullStackDevelopment
To view or add a comment, sign in
-
-
Day 21– Thread Methods in Java Today I explored how to control threads in Java using different methods. Things I learned: 🔹 start() – begins thread execution 🔹 run() – contains logic (called internally) 🔹 sleep() – pauses thread for a specific time 🔹 join() – ensures one thread finishes before another starts 💡 Key takeaway: Thread methods help manage execution flow and improve control over multithreading behavior. Step by step understanding how Java handles concurrent tasks 🚀 #Java #Multithreading #Threads #Programming #LearningInPublic #Day21 #100DaysOfJava
To view or add a comment, sign in
-
-
#Day_13 of My Java Learning Journey – Writing Functions in Java Today I practiced how to create functions (methods) in Java, and I built a simple program to check whether a number is Even or Odd. 🔥 What I learned today: ✔ How to create a boolean function ✔ How to use if-else conditions inside a method ✔ How to return true/false ✔ How to call a method inside the main() function ✔ How to print the result in the console 🧩 Example I worked on: I created a method IfEven(int a) that: Prints whether the number is Even or Odd Returns a boolean value (true for even, false for odd) This helped me understand functions more clearly and how they improve code structure and reusability. #Java #LearningJourney #100DaysOfCode #Coding #Developer #JavaBeginners #OOP #CodeNewbie
To view or add a comment, sign in
-
-
Multithreading in Java finally clicked for me when I stopped memorizing it… and started visualizing it. 🧠 Here’s the simplest way to understand it: Imagine your application is doing only ONE task at a time. ➡️ Slow ➡️ Blocking ➡️ Poor performance Now introduce multithreading 👇 Multiple tasks run simultaneously: ✔ One thread handles API requests ✔ One processes data ✔ One writes logs Result? Faster and more efficient applications 🚀 But here’s what I learned the hard way: Multithreading is powerful… but dangerous if not handled properly. Common issues I faced: Race conditions Deadlocks Unexpected bugs What helped me: ✔ Proper synchronization ✔ Understanding thread lifecycle ✔ Using ExecutorService instead of manual threads Lesson: Multithreading is not just about speed — it’s about control and correctness. 💬 Have you faced any tricky bugs with multithreading? #Java #Multithreading #BackendDevelopment #SoftwareEngineering #Coding
To view or add a comment, sign in
-
Day 38 of Learning Java Today, I explored how a class executes inside the JVM (Java Virtual Machine). Understanding this lifecycle really helped me see what happens behind the scenes when we run a Java program. 🔹 Class Loading • The JVM loads the class into memory • It brings the ".class" file into the system 🔹 Linking Phase • Verification → Checks bytecode for errors • Preparation → Allocates memory for static variables (default values like 0) • Resolution → Replaces symbolic references with actual memory references 🔹 Initialization • Static variables get their actual assigned values • Static blocks are executed 🔹 Execution • Methods start running and the program logic is executed 🔹 Destruction • Objects are destroyed and memory is cleaned up by the Garbage Collector Static variables first get default values during preparation, and later their actual values during initialization. Thanks to my mentor Ashim Prem Mahto for the clear explanations and for always clearing my doubts. #Java #JVM #LearningJourney #Programming #SoftwareDevelopment #BackendDevelopment #CodingLife #JavaDeveloper #TechLearning #StudentLife
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