🚀 Today’s Java Learning Update — Polymorphism & Memory Behavior Today I practiced Polymorphism in Java and understood how values behave differently in Stack and Heap memory. 🔹 Primitive types (like int) are stored in stack memory — changes inside methods don’t affect the original value. 🔹 Objects are stored in heap memory — when passed to methods, their internal data can be modified. 🔹 This helped me clearly see how Java handles pass-by-value and object references. I implemented a small example to observe how object fields change while primitive variables remain unchanged after method calls. Learning step by step and pushing my practice code daily on GitHub 💻 #Java #OOP #Polymorphism #HeapMemory #StackMemory #LearningJourney
Java Polymorphism and Memory Behavior Explained
More Relevant Posts
-
Day 27.. 💡 Today’s Learning: Method Overloading in Java Today, I explored Method Overloading in more depth! 🚀 🔹 What is Method Overloading? Method Overloading allows a class to have: ✅ Same method name ✅ Different parameters The Java compiler differentiates overloaded methods based on: 1️⃣ Number of parameters 2️⃣ Data types of parameters 3️⃣ Sequence of parameters 4️⃣ Implicit typecasting 👉 The compiler also considers implicit typecasting while resolving overloaded methods, which can sometimes lead to ambiguity if multiple methods match. 🔎 Bonus Insight: Yes, the main() method can be overloaded in Java. However, the JVM always starts execution from the standard signature: public static void main(String[] args) Any overloaded version must be called manually. ✨ Key Takeaway: Method Overloading improves code readability, reusability, and flexibility, making it a powerful concept in Java’s Object-Oriented Programming. Learning something new every day! 💪 #Java #OOP #MethodOverloading #Programming #LearningJourney #JavaDeveloper
To view or add a comment, sign in
-
-
🚀 Day 14 of my Java Learning Journey ✨Topic: Polymorphism Today I explored one of the most powerful OOPS Concept- polymorphism 📌 What is polymorphism?? polymorphism = many forms In Java, it allows the same method name to behave differently depending on the object. 🔷 Two Types of polymorphism 1️⃣ Compile time polymorphism. ▪️Method overloading same method name, different parameters 2️⃣ Run time polymorphism ▪️Method Overriding Subclass provides a specific implementation of a method. ✅ Polymorphism makes Java applications scalable, maintainable, and dynamic 💡 #Java #CodingJourney #Day14 #JavaLearning #OOP
To view or add a comment, sign in
-
-
Understanding Marker Interfaces in Java — Simple Concept, Powerful Impact Today I explored an interesting Core Java concept: Marker Interface. A Marker Interface is an empty interface (no methods, no fields) used to mark a class. This mark tells the JVM or compiler that the class has some special behavior or permission. In simple terms — it’s a way to attach metadata through inheritance. 💡 Why Marker Interfaces matter: They help Java decide: ✅ How an object should be treated ✅ Which operations are allowed or restricted ✅ What special behavior must be applied Even though they look “empty,” they play a huge role behind the scenes — classic examples include Serializable, Cloneable, and RandomAccess. Learning this made me realize how Java uses design patterns at a deep level to control behavior without adding extra code. Grateful for the guidance and clarity from my mentor Anand Kumar Buddarapu 🙏 Still learning Core Java step by step — building strong fundamentals. 💻🔥 #Java #CoreJava #MarkerInterface #OOP #JavaLearning #BackendDevelopment #StudentDeveloper #LearningByDoing
To view or add a comment, sign in
-
💻 Common Java Mistakes I Faced While Learning OOPJ While practicing Java (OOPJ), I realized that errors are not failures — they are feedback. Sharing a few basic but very common mistakes I personally faced during coding 👇 🔹 Using a Java keyword as a variable name 🔹 Assigning values to variables with wrong data types 🔹 Class name and file name not matching 🔹 Writing multiple main methods without proper overloading 🔹 Forgetting to close a class or main method 🔹 Trying to change the value of a final variable 🔹 Attempting to make a constructor static 🔹 Accessing instance variables directly inside static methods Each error forced me to understand: how Java actually works, the difference between static vs instance, and why the compiler complains (not what it complains about). 💡 Biggest takeaway: If your program runs perfectly on the first try, you’re probably not learning enough. Still learning, still debugging, still improving 🚀 Attaching all the errors for quick glance: #Java #OOPJ #LearningByDoing #ProgrammingErrors #ComputerScience #StudentLife #Debugging
To view or add a comment, sign in
-
Today I learned about Recursion in Java, a powerful concept that helps solve complex problems by breaking them into smaller ones. A recursive method calls itself until a base condition stops it. Understanding recursion improved my logical thinking and problem-solving skills, especially for DSA topics like trees, backtracking, and divide-and-conquer algorithms. Implementing examples like factorial and Fibonacci made the concept clear and practical. Recursion is a technique where a method calls itself to solve a problem. It helps in breaking complex problems into smaller, manageable subproblems. 📌 What is Recursion? A recursive method has: 1️⃣ Base Case – Condition to stop recursion 2️⃣ Recursive Case – Method calling itself Without a base case, it leads to infinite recursion and StackOverflowError. #Java #Recursion #DSA #CodingJourney #Learning #ComputerScience
To view or add a comment, sign in
-
🚀 DSA Journey — LeetCode Practice 📌 Problem: Increasing Triplet Subsequence 💻 Language: Java 🔹 Approach: To determine whether an increasing triplet exists, I tracked the smallest and second smallest values during a single traversal. • Initialize two variables (first, second) with large values • Traverse the array once • Update first if current number is smaller • Else update second if number is between first and second • If a number larger than both appears → increasing triplet found • Return true immediately, otherwise false This avoids sorting or nested loops and keeps the solution efficient. ⏱ Time Complexity: O(n) 🧩 Space Complexity: O(1) 📖 Key Learning: Maintaining running minimum values while scanning taught me how greedy updates can reveal patterns without extra memory or multiple passes. Simple comparisons can solve seemingly complex subsequence problems 💡 hashtag#DSA hashtag#Java hashtag#LeetCode hashtag#ProblemSolving hashtag#CodingJourney hashtag#LearningInPublic hashtag#DSAWithedSlash
To view or add a comment, sign in
-
-
🔁 Polymorphism in Java – One Interface, Many Forms Polymorphism is one of the core pillars of Object-Oriented Programming in Java. It allows a single method call to behave differently based on the object type at runtime. 👉 In simple words: Same method name, different behavior. 💡 How it works in Java A parent class reference can point to different child class objects The method that gets executed is decided at runtime (Dynamic Method Dispatch) Achieved using method overriding 🧠 Why Polymorphism is important? ✔ Improves code flexibility ✔ Supports scalability ✔ Makes code easier to maintain ✔ Enables real-world modeling Even though the method name is the same, the output changes based on the object. 🚀 Key Takeaway Polymorphism lets Java decide “which method to call” at runtime, not compile time. #Java #Polymorphism #OOP #ObjectOrientedProgramming #JavaDeveloper #CoreJava #LearningJava #ProgrammingConcepts #SoftwareDevelopment #TapAcademy TAP Academy, Sharath R
To view or add a comment, sign in
-
-
💡 Java Learning Series – final vs finally vs finalize These three terms sound similar in Java but have completely different purposes. Here’s a simple breakdown: ✔️ final – A keyword used to restrict modification. → Final variable = constant value → Final method = cannot be overridden → Final class = cannot be inherited ✔️ finally – A block used in exception handling. → Always executes whether an exception occurs or not → Commonly used for closing resources like files or database connections ✔️ finalize() – A method called by the garbage collector before object destruction (now rarely used and mostly deprecated in modern Java). Understanding these small differences helps avoid confusion and write better Java code.🚀 #Java #CoreJava #Programming #JavaDeveloper #CodingJourney #LearningJava
To view or add a comment, sign in
-
🚀 DSA in Java – Day 72 ✅ LeetCode Problem Solved: Subsets II 🔁 Concept Used: Backtracking + Recursion 🧠 Key Focus: Handling duplicate elements correctly Today I solved Subsets II, where the main challenge was generating all unique subsets from an array that may contain duplicates. 🔑 What I learned: Why sorting the array is important before recursion How to skip duplicates using this condition: if (idx > i && nums[idx] == nums[idx - 1]) continue; Proper backtracking steps (add → recurse → remove) How recursion builds subsets step by step Learning something new every day and getting better at problem-solving 💪 #DSA #Java #LeetCode #Backtracking #Recursion #ProblemSolving #CodingJourney #DailyLearning #Consistency
To view or add a comment, sign in
-
-
🚀 Learning Update: Core Java — Method Overloading & Compile Time Polymorphism Today’s session helped me understand one of the most important OOP concepts in Java — Method Overloading, along with related concepts like compile-time polymorphism, type promotion, and ambiguity. 📌 Key Learnings: ✅ Method Overloading Learned that method overloading is the process of creating multiple methods with the same name within the same class, but with different parameters (number or type). ✅ Compile-Time Polymorphism (Static Binding / Early Binding) Understood that method overloading happens during the compilation phase and is handled by the Java compiler, not the JVM. ✅ Three Rules of Method Overloading Resolution: 1️⃣ Method Name 2️⃣ Number of Parameters 3️⃣ Type of Parameters These rules help the compiler decide which method should be executed. ✅ Type Promotion Learned how Java automatically converts data types to the closest compatible type when an exact method match is not available. ✅ Ambiguity in Method Overloading Explored scenarios where the compiler gets confused when multiple methods match equally, leading to ambiguity errors. ✅ Real-World Understanding A very interesting realization was that we already use method overloading in Java daily — for example, System.out.println() has multiple overloaded versions internally. 💡 Important Insight: Understanding concepts deeply with logic and real examples is much more powerful than just memorizing definitions — especially for technical interviews. Consistent practice and conceptual clarity are key to becoming a confident developer. #Java #CoreJava #Programming #MethodOverloading #OOP #LearningUpdate #CodingJourney #StudentDeveloper TAP Academy
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