Day 29 of Learning Java 🚀 Today I went deeper into understanding how Java actually runs behind the scenes inside the JVM. Some interesting things I discovered today: ⚡ Learned the execution order in Java when a program has static variables → static blocks → instance variables → instance blocks → constructors → methods. ⚡ The JVM usually checks static members first. If there are no static members, execution starts from main() since it is also a static method. ⚡ Understood the use of static variables and how they save memory by storing values in a shared memory area (static segment / class area). ⚡ Learned that objects are also called instances. ⚡ Important concept: Instance variables cannot be accessed directly by static methods Static variables can be accessed by instance methods ⚡ Learned how static blocks can initialize static variables. ⚡ Explored JVM components like Class Loader, Interpreter, and JIT compiler. ⚡ Practiced compiling and running Java programs using Command Prompt (javac and java). ⚡ Also understood that the number of bytecode (.class) files generated depends on how many classes exist in the program. Small steps every day, but building strong Core Java fundamentals. 💻 #Day29 #Java #CoreJava #JVM #Programming #LearningJourney Harshit T
Java JVM Execution Order and Static Variables
More Relevant Posts
-
When I first started learning Java, garbage collection felt like magic. 1)You create objects. 2)The program get runs. 3)Unused memory gets cleaned up. But Java memory is not just one big box. Here is the simple model: * New objects start in Young Generation * Long-living objects move to Old Generation * Unused objects get removed by the Garbage Collector Example: A temporary list created inside a method usually dies young and gets cleaned quickly. But something like cache data or a session object can survive longer and move to the Old Generation. That matters because: * Young Generation collection is usually fast * Old Generation collection is heavier * Understanding both helps you reason about performance #Java #SpringBoot #BackendDevelopment #SoftwareEngineerr #javadeveloper
To view or add a comment, sign in
-
-
While learning core Java concepts, I recently explored the Collection Hierarchy, and it gave me a clearer understanding of how Java manages and organizes groups of objects efficiently. The Java Collection Framework provides a set of interfaces and classes designed to store, retrieve, and manipulate data in different ways depending on the requirement. 🔹 List – Maintains insertion order and allows duplicate elements. Examples: ArrayList, LinkedList, Vector, Stack. 🔹 Set – Stores only unique elements and prevents duplication. Examples: HashSet, LinkedHashSet, TreeSet. 🔹 Queue – Designed for processing elements typically in FIFO (First In First Out) order. Examples: PriorityQueue, ArrayDeque. Understanding this hierarchy helps developers choose the right data structure based on ordering, uniqueness, and performance requirements. #Java #JavaCollections #SoftwareDevelopment #JavaDeveloper #Programming #Learning
To view or add a comment, sign in
-
-
🚀 Day 7/45 – Working with Strings in Java On Day 7 of my Java learning journey, I explored the concept of Strings, which are used to store and manipulate text data in programs. Strings are widely used in almost every application, from user input to data processing. 📚 What I Learned Today Today I learned: ✔ What strings are and how they are created in Java ✔ Important string methods like length(), charAt(), and toUpperCase() ✔ How to compare strings using equals() ✔ Understanding case-sensitive and case-insensitive comparisons 💻 Practice Work To strengthen my understanding, I implemented: • A program to reverse a string • A program to count characters in a string • A palindrome checker using string logic 🎯 Key Takeaway Strings are a fundamental part of programming, and mastering string manipulation is essential for solving real-world problems. Consistent daily practice is helping me build strong fundamentals step by step. #Java #Programming #LearningInPublic #CodingJourney #SoftwareDevelopment #Consistency
To view or add a comment, sign in
-
🚀 Java Revision Journey – Day 07 Continuing my Java revision journey, today I focused on the four pillars of Object-Oriented Programming (OOP) in Java. 🔖 Topics Covered 1️⃣ Inheritance Allows one class to acquire the properties and behaviors of another class using the extends keyword. It promotes code reusability and hierarchical relationships between classes. 2️⃣ Encapsulation Wrapping data (variables) and methods into a single unit (class) and restricting direct access using private variables with getters and setters. It ensures data security and controlled access. 3️⃣ Polymorphism Means “many forms”. The same method name can behave differently depending on the situation. Examples: Method Overloading (Compile-time polymorphism) Method Overriding (Runtime polymorphism) 4️⃣ Abstraction Hiding internal implementation details and showing only essential functionality using abstract classes and interfaces. 📌 These four concepts form the foundation of Object-Oriented Programming and scalable Java application design. Every day of revision is strengthening my Java fundamentals step by step. 💻 #Java #OOP #JavaDeveloper #JavaLearning #BackendDevelopment #Programming #JavaRevision #LearningJourney
To view or add a comment, sign in
-
-
🚀 Day 25 of My Java Learning Journey Today I learned about the Object Class in Java and its important methods. 🔹 The Object class is the parent of all classes in Java. 🔹 toString() is used to convert an object into a readable string format. 🔹 clone() is used to create a copy of an object. 🔹 Java is not a purely object-oriented language because it uses primitive data types like int, char, and float. 🔹 Wrapper classes such as Integer, Double, and Character help convert primitive types into objects. Example: Employee e = new Employee(); System.out.println(e); Internally, Java calls: e.toString(); Every day I am improving my Java skills step by step 💪 Consistency + Practice = Growth 📈 #Java #ObjectOrientedProgramming #Programming #LearningJourney #100DaysOfCode #SoftwareDevelopment
To view or add a comment, sign in
-
-
Continuing my progress in Java, I’ve recently explored some important object-oriented and structural concepts that deepen my understanding of how real-world applications are designed. Here are the topics I covered: Containment (Has-A relationship) and how objects can be composed within other classes Method Overloading for achieving compile-time polymorphism Static Import to simplify code by directly accessing static members Inheritance for creating hierarchical relationships and promoting code reusability Packages for organizing classes and maintaining scalable project structure These concepts helped me better understand how to design modular, reusable, and maintainable Java applications. Step by step, moving closer to mastering core Java and applying these concepts in real-world scenarios. #Java #OOP #Programming #LearningJourney #SoftwareDevelopment #CDAC
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
-
-
📰 Breaking News --->> Static Variables & Methods Simplify Java Development! While learning Java, one concept that truly changes how you write efficient code is the static keyword. ** Static members belong to the class, not individual objects. This means they are shared, memory-efficient, and easy to access. ~ What’s the Big Idea? 🔹 Static Variables One copy shared across all objects Saves memory Perfect for common data (e.g., interest rate, company name) 🔹 Static Methods Called without creating objects Best for utility/helper functions Example: main() method 💡 Real-World Example 🏦 Imagine a Bank Application: Interest Rate → Static Variable (same for all customers) Customer Data → Instance Variables √ Instead of storing interest rate for every user, √we store it once using static. -->>Why It Matters ✔ Efficient memory usage ✔ No need to create objects for common operations ✔ Cleaner and more organized code ✔ Widely used in real-world applications 📌 Takeaway #Use static variables for shared data #Use static methods for logic that doesn’t #depend on object state @𝘾𝙤𝙢𝙢𝙚𝙣𝙩 𝙤𝙣 𝙩𝙝𝙞𝙨 𝙌𝙪𝙚𝙨𝙩𝙞𝙤𝙣👇 💬 What’s your favorite use case of static in Java? TAP Academy #Java #CoreJava #OOP #JavaDeveloper #Programming #Coding #SoftwareDevelopment #LearnJava
To view or add a comment, sign in
-
-
🚀 Mastering Core Java | Day 21 📘 Topic: TreeSet in Java Today’s learning focused on TreeSet, an important implementation of the Set interface that maintains sorted and unique elements. 🔹 Core Features of TreeSet Stores unique elements (no duplicates) Maintains sorted order (natural or custom) Implements NavigableSet interface 🔹 Key Characteristics Uses Red-Black Tree internally ⏱ Time Complexity: O(log n) for add, remove, contains ❌ Does not allow null elements Ensures automatic sorting 🔹 Example: Set<Integer> set = new TreeSet<>(); set.add(30); set.add(10); set.add(20); System.out.println(set); // Output: [10, 20, 30] 🔹 When to Use TreeSet? ✔ When you need sorted + unique data ✔ When elements are Comparable or a Comparator is provided ✔ When order matters more than speed 💡 Key Takeaway: TreeSet is ideal when you want automatically sorted data with uniqueness, even though it is slightly slower than Hashset #CoreJava #JavaCollections #TreeSet #JavaDeveloper #LearningJourney #DataStructures #Day21 🚀
To view or add a comment, sign in
-
-
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 🚀
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