DAY 11: CORE JAVA 🔹 Understanding Variables in Java & Memory Allocation in JRE While learning Java, one concept that truly strengthened my foundation is understanding how variables work and how memory is allocated inside the JRE. 📌 Types of Variables in Java: 1️⃣ Local Variables Declared inside methods, constructors, or blocks Stored in Stack Memory Exist only during method execution 2️⃣ Instance Variables Declared inside a class but outside methods Stored in Heap Memory Each object gets its own copy 🧠 How Memory is Allocated in JRE When a Java program runs, memory is divided mainly into: 🔹 Stack Memory Stores method calls, local variables Works in LIFO (Last In First Out) order Automatically cleared after method execution 🔹 Heap Memory Stores objects and instance variables Managed by Garbage Collector Objects remain until no longer reference 💡 Why This Matters Understanding memory allocation helps in: ✔ Writing optimized code ✔ Avoiding memory leaks ✔ Understanding stack overflow errors ✔ Building strong OOP fundamentals Learning these internal concepts makes Java much more logical and structured rather than just syntax-based coding. TAP Academy #Java #Programming #OOP #LearningJourney #SoftwareDevelopment #CoreJava
Java Variables & Memory Allocation in JRE
More Relevant Posts
-
Deep Dive into Core Java Concepts 🚀 Today, I explored some important Java concepts including toString(), static members, and method behavior in inheritance. 🔹 The toString() method (from Object class) is used to represent an object in a readable format. By default, it returns "ClassName@hashcode", but by overriding it, we can display meaningful information. 🔹 Understanding static in Java: ✔️ Static variables and methods are inherited ❌ Static methods cannot be overridden ✔️ Static methods can be hidden (method hiding) 🔹 What is Method Hiding? If a subclass defines a static method with the same name and parameters as the parent class, it is called method hiding, not overriding. 🔹 Key Difference: ➡️ Overriding → applies to instance methods (runtime polymorphism) ➡️ Method Hiding → applies to static methods (compile-time behavior) 🔹 Also revised execution flow: ➡️ Static blocks (Parent → Child) ➡️ Instance blocks (Parent → Child) ➡️ Constructors (Parent → Child) This learning helped me clearly understand how Java handles inheritance, memory, and method behavior internally. Continuing to strengthen my Core Java fundamentals 💻🔥 #Java #OOP #CoreJava #Programming #LearningJourney #Coding
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
-
-
🚀 Before Learning Spring Boot, Understand Java Annotations Annotations in Java are used to provide metadata about the code, such as information about classes, methods, or variables. They do not directly change the program logic but help the compiler and frameworks understand how the code should be processed. Java also provides meta-annotations, which define how other annotations behave. Two important ones are: • @Target – Specifies where an annotation can be applied (class, method, field, parameter, etc.) • @Retention – Defines how long the annotation is available (source, class, or runtime) Annotations can also be understood in different ways: ✔ Compile-time annotations – Example: @Override, checked by the compiler during compilation. ✔ Runtime annotations – Example: @Deprecated, which can also be accessed at runtime using reflection. ✔ Target-based annotations – Example: @FunctionalInterface, which is applied at the interface level to ensure the interface has only one abstract method. Since Spring Boot is heavily annotation-driven, understanding Java annotations makes it easier to grasp concepts like dependency injection, configuration, and component scanning. Building strong fundamentals always makes learning frameworks much smoother. What was the first Java annotation you learned? 👇 #Java #SpringBoot #BackendDevelopment #Programming #LearningInPublic
To view or add a comment, sign in
-
🚀 Today I Learned – Java Static in Inheritance & Object Class Today I strengthened my understanding of some important Java concepts: 🔹 Static Variable Inheritance Static variables are inherited, but only one shared copy exists across the entire class hierarchy. 🔹 Static Methods & Method Hiding Static methods are inherited, but they cannot be overridden — they are hidden based on the reference type. 🔹 Execution Order in Inheritance Understanding the flow is important: Static Block → Instance Block → Parent Constructor → Child Constructor 🔹 Object Class as Root Every class in Java automatically inherits from the Object class. 🔹 Default vs Custom toString() By default, toString() returns: ClassName@Hashcode But we can override it to return meaningful and readable output. ✨ Small concepts, but very important for writing clean and predictable Java programs. TAP Academy #Java #OOP #Programming #LearningJourney #ComputerScience #JavaDeveloper #TapAcademy
To view or add a comment, sign in
-
-
DAY 30: CORE JAVA 🚀 Understanding "this()" vs "super()" in Java – A Quick Guide! While working with constructors in Java, two important calls often come into play: "this()" and "super()". Though they may seem similar, they serve very different purposes. 🔹 "this()" Call - Used to achieve constructor chaining within the same class. - Helps reuse constructors in a clean and efficient way. - It is optional and depends on the programmer’s need. 🔹 "super()" Call - Used to achieve constructor chaining between parent and child classes. - It is automatically invoked by Java (default behavior). - Always placed on the first line of the child class constructor. ⚠️ Important Rule 👉 "this()" and "super()" cannot be used together in the same constructor, as both must be the first statement. 💡 Key Insight Subclass variables always have higher priority than superclass variables. To access parent class variables when both have the same name, we use "super". 📌 Mastering these concepts is essential for writing clean and efficient code using inheritance in Java. TAP Academy #Java #OOP #Programming #CodingTips #SoftwareDevelopment
To view or add a comment, sign in
-
-
📘 Abstract Class vs Interface in Java — Key Differences Today I explored one of the most important OOP concepts in Java: the difference between Abstract Classes and Interfaces. Both are used to achieve abstraction, but they serve different design purposes in Java applications. 🔹 Abstract Class • Supports partial abstraction • Can contain both abstract and concrete methods • Allows instance variables and constructors • Supports single inheritance using extends 🔹 Interface • Used for full abstraction (mostly) • Methods are public and abstract by default • Variables are public static final • Supports multiple inheritance using implements 💡 Key takeaway: Abstract classes are used when classes share common behavior, while interfaces define a contract that multiple unrelated classes can implement. Understanding when to use each helps in writing clean, scalable, and maintainable Java code. A special thanks to my mentor kshitij kenganavar sir for clearly explaining the concepts of Abstract Classes and Interfaces in Java. #Java #OOP #JavaProgramming #AbstractClass #Interface #SoftwareDevelopm
To view or add a comment, sign in
-
-
🚀 Mastering Core Java | Day 13 📘 Topic: Multithreading in Java Today’s learning focused on Multithreading, an important concept in Java that allows programs to perform multiple tasks simultaneously, improving performance and responsiveness. 🔹 What is a Thread? A thread is a lightweight unit of execution within a program. Key Points: Represents a single path of execution Shares resources like memory Enables concurrent task processing 🔹 What is Multithreading? Multithreading is the process of running multiple threads at the same time within a program. Benefits: ✔ Better CPU utilization ✔ Faster task execution ✔ Improved application responsiveness ✔ Efficient resource sharing 🔹 Java Thread Lifecycle A thread goes through several states during execution: 1️⃣ New – Thread is created 2️⃣ Runnable – Ready to run and waiting for CPU 3️⃣ Running – Thread is executing 4️⃣ Waiting / Blocked – Waiting for resources or other threads 5️⃣ Terminated – Execution completed 🔹 Ways to Create Threads in Java 1️⃣ Extending the Thread Class class MyThread extends Thread { public void run() { System.out.println("Thread is running"); } } 2️⃣ Implementing the Runnable Interface class MyRunnable implements Runnable { public void run() { System.out.println("Thread is running"); } } 💡 Key Takeaway: Multithreading helps build efficient, high‑performance, and responsive applications, especially when handling multiple tasks at the same time. Vaibhav Barde sir Grateful for the continuous learning and guidance that helps strengthen my Core Java fundamentals step by step. #CoreJava #Multithreading #JavaDeveloper #JavaLearning #Day13 #Programming #SoftwareDevelopment #LearningJourney 🚀
To view or add a comment, sign in
-
-
📅 100 Days of Java – Day 1 🚀 Language: Java 🎯 Focus Topic: Scanner Input, If/Else, and Loops Today I started my 120 Days of Java challenge by focusing on the basics that every programmer must understand first — taking user input and controlling program flow. I explored how Java programs interact with users using the Scanner class. Instead of hardcoding values, the program can accept input at runtime, making it more dynamic and practical. I also practiced conditional statements (if / else) to allow the program to make decisions based on the input. This is one of the core building blocks of programming logic. Next, I worked with loops (for and while), which help automate repetitive tasks. Learning loops is important because they allow us to process multiple values or repeat operations efficiently. Through small programs, I applied these concepts to understand how logic flows step by step inside a program. This is just the beginning of my journey, but mastering the fundamentals is the key to writing better and more efficient programs in the future. 💬 Discussion: What is the difference between while loop and for loop? A for loop is usually used when the number of iterations is known beforehand, while a while loop is useful when the loop should run until a certain condition becomes false and the number of iterations is not fixed. #JavaProgramming #JavaDeveloper #JavaLearning #JavaJourney #120DaysOfJava #100DaysOfCode #CodingChallenge #DailyCoding #CodeEveryday #LearnInPublic #Programming #SoftwareDevelopment #DeveloperJourney #TechLearning #CodingLife #CodeNewbie #FutureDeveloper #ComputerScience #ProblemSolving #BuildInPublic #DeveloperCommunity #TechCommunity #StudentDeveloper #CodingPractice #ProgrammingLife #Developers #TechSkills #GrowthMindset #LearningJourney
To view or add a comment, sign in
-
🚀 Day 18 – Understanding Core Java OOP Foundations Today’s focus was on strengthening my understanding of some fundamental Object-Oriented Programming concepts in Java that are widely used in real-world applications. 📚 Concepts Learned ✔ this keyword – Understanding how it refers to the current object and helps differentiate instance variables from parameters. ✔ static keyword – Learning how class-level variables and methods are shared across all objects. ✔ Constructors – Using constructors to initialize objects automatically during object creation. ✔ Code Blocks – Understanding how Java executes initialization blocks. 💻 To reinforce these concepts, I implemented Java programs demonstrating constructors, instance variables, and static variables, helping me understand how objects are created and how memory is managed in Java. Every day I aim to focus on understanding concepts deeply rather than just completing topics, because strong fundamentals are the key to becoming a better developer. #100DaysOfCode #Java #CoreJava #OOP #ObjectOrientedProgramming #JavaDeveloper #SoftwareDevelopment #Programming #CodingJourney #DeveloperLife #BackendDevelopmen #TechLearning
To view or add a comment, sign in
-
-
🚀 Day 7 – Understanding Methods in Java Today I focused on one of the most important concepts in Java — Methods. While it may seem like a basic topic, methods are the foundation of writing clean, reusable, and modular code. 📌 What I Worked On: • Created methods with and without return types • Passed parameters to methods • Returned values using return keyword • Practiced calling methods from the main() method • Built small programs like: Addition of two numbers Even/Odd checker Greeting user using parameters 🔎 Key Learning Outcomes: ✔ Understood how methods improve code reusability ✔ Learned the difference between void methods and value-returning methods ✔ Practiced writing modular code instead of everything inside main() ✔ Strengthened problem-solving by breaking logic into smaller functions This session helped me understand how structured programming works and why modular design is critical in real-world applications. #100DaysOfCode #Java #OOP #ProgrammingFundamentals #JavaDeveloper #SoftwareDevelopment #LearningInPublic #CodeNewbie
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