✅ Subtyping: There are two classes A and B. Here class B is inherited from class A. class A is called super type and class B is called sub type. As per subtyping rule wherever super type A is required you can replace with its sub type B. ✅Super Keyword: super is used to refer super class and parent class object. 1)super. : ▪️ super. is used to call super class variables/methods in subclass. 2)super() /super method: ▪️ super() is used to call super class constructor in sub class constructor. 👉 This should be first statement in constructor.This process is called constructor chaining. ✅ Method Overriding: Method overriding occurs when a subclass provides its own implementation of a method defined in the parent class. Why it's useful? ✔ Enhances or customizes existing functionality ✔ Enables runtime polymorphism 🔹 Same method name, same parameters, but defined differently in the subclass. ✅ Dynamic Method Dispatch: Dynamic method dispatch is the mechanism by which the overridden method is selected at runtime, not compile time. Thanks to our mentor Anand Kumar Buddarapu Sir for explaining these concepts clearly. #Java #OOPS #Polymorphism #Subtyping #MethodOverriding #DynamicDispatch #Superkeyword
Understanding Subtyping, Super Keyword, Method Overriding, and Dynamic Dispatch in Java
More Relevant Posts
-
Why abstract class needs a constructor? 🤔 Even though you can’t create an object of an abstract class, its constructor still runs — because it helps initialize common properties when a subclass object is created! 🔥 💡 Example: The abstract class sets up base variables or logs setup info before the child class adds its own behavior. #Java #OOPs #Constructor #AbstractClass #JavaConcepts #CodingReels #Skillio #JavaForBeginners
To view or add a comment, sign in
-
🚀 Day 08/10 of Linked List Series: Delete a Node by its Index🎯 🧠 Algorithm (Step-by-Step Explanation) 1️⃣ Start from the head of the linked list. 2️⃣ If the index = 0, it means we want to delete the first node — so just move the head to the next node. 3️⃣ Otherwise, use a loop to reach the node just before the target index (that is, index - 1). 4️⃣ Once you reach there, skip the next node by connecting the current node’s next pointer to the node after the one being deleted. 5️⃣ Return the (possibly updated) head of the linked list. 🪄 Simple Understanding: Imagine a chain of people holding hands (each one pointing to the next). If you want to remove the person at position index, just tell the person before them to hold the hand of the one after them — the middle one is now “unlinked” and effectively deleted! 🔥 Keep Learning — Keep Building #CodeWithLakkojuEswaraSai #CodeWithLakkojuEswaraSai_LinkedList #Java #DSA #DataStructures #LinkedList #CodingCommunity #100DaysOfCode #ProgrammerLife #LearnWithMe #CodeEveryday #TechJourney #CodingIsFun #JavaDevelopers #SoftwareEngineering #CodeNewbie
To view or add a comment, sign in
-
-
📌 Day 4/100 - Minimum Size Subarray Sum (LeetCode 209) 🔹 Problem: Given an array of positive integers and a target value, find the minimal length of a contiguous subarray whose sum is greater than or equal to the target. If there’s no such subarray, return 0. 🔹 Approach: Used the Sliding Window technique for an optimized solution: Initialize two pointers (low, high) and a running sum. Expand the window by moving high until the sum ≥ target. Once valid, shrink the window from the left to find the smallest subarray. Keep updating the minimum length throughout. This reduced the time complexity from O(n²) (brute force) to O(n). 🔹 Key Learning: Sliding Window is ideal for problems with contiguous subarrays. Optimization often comes from adjusting the window efficiently. Each problem strengthens logical flow and pattern recognition. Another step forward in mastering DSA and problem-solving consistency! ⚡ #100DaysOfCode #LeetCode #Java #ProblemSolving #DSA #CodingChallenge #SlidingWindow
To view or add a comment, sign in
-
-
𝐃𝐚𝐲 𝟏𝟖 𝐨𝐟 #50DaysOfDSA 𝐋𝐞𝐞𝐭𝐂𝐨𝐝𝐞 𝟑𝟐𝟐𝟖 — 𝐌𝐚𝐱𝐢𝐦𝐮𝐦 𝐍𝐮𝐦𝐛𝐞𝐫 𝐨𝐟 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐨𝐧𝐬 𝐭𝐨 𝐌𝐨𝐯𝐞 𝐎𝐧𝐞𝐬 𝐭𝐨 𝐭𝐡𝐞 𝐄𝐧𝐝 (𝐌𝐞𝐝𝐢𝐮𝐦) 𝐏𝐫𝐨𝐛𝐥𝐞𝐦 𝐋𝐢𝐧𝐤 - https://lnkd.in/gu-Rnxuv 𝐒𝐨𝐥𝐮𝐭𝐢𝐨𝐧 𝐋𝐢𝐧𝐤 - https://lnkd.in/gvh4gS2z Ever thought how many times you can shift all '1's to the end of a binary string? That’s exactly what this problem challenges you to find! 𝐏𝐫𝐨𝐛𝐥𝐞𝐦 𝐒𝐮𝐦𝐦𝐚𝐫𝐲: You’re given a binary string s. In one operation, you can pick an index i where s[i] == '1' and s[i+1] == '0', and move that '1' to the right until it reaches the end or just before another '1'. Your goal find the maximum number of such operations possible. 𝐈𝐧𝐭𝐮𝐢𝐭𝐢𝐨𝐧: Instead of simulating the moves, observe that: Each '1' can contribute operations only when it faces zeros that form a boundary (zero-block end). So, every time we hit the last zero of a block, we can add the count of '1's before it. This insight keeps the solution linear O(n) time, O(1) space! 𝐓𝐚𝐤𝐞𝐚𝐰𝐚𝐲: Sometimes, the key to optimizing problems isn’t simulation, it’s pattern recognition. Spot the structure → derive the formula → simplify! #LeetCode #Java #CodingChallenge #DSA #ProblemSolving #Programming #50DaysOfCode
To view or add a comment, sign in
-
-
🚀 You use ArrayList every day. But do you know what’s hiding under the hood? 👇 We all use this line every day 👇 List<String> list = new ArrayList<>(); Here’s the real inheritance chain 👇 Iterable ↓ Collection (extends Iterable) ↓ AbstractCollection (implements Collection) ↓ List (extends Collection) ↓ AbstractList (extends AbstractCollection, implements List) ↓ ArrayList (extends AbstractList, implements List, RandomAccess, Cloneable, Serializable) 💡 Quick takeaways: ✅ Iterable is what makes enhanced for-loops (for-each) possible. ✅ AbstractCollection & AbstractList provide skeleton implementations so subclasses only need to implement key methods. ✅ ArrayList adds dynamic resizing, fast lookups, and cloning support. ⚙️ Hidden Insight: Your everyday ArrayList isn’t just a list — it’s a layered masterpiece of interfaces + abstract classes + marker interfaces that make it fast, flexible & reliable 🚀 #Java #Coding #DeveloperTips #ArrayList #Programming #LearnJava #OOP
To view or add a comment, sign in
-
🚀 Day-73 of #100DaysOfCodeChallenge 💡 LeetCode Problem: 3354. Make Array Elements Equal to Zero (Easy) 🧠 Concepts Practiced: Simulation, Array Manipulation, Direction Reversal Logic Today’s problem was all about simulating a dynamic process — starting from a zero element in an array, moving in a chosen direction, and adjusting movement logic as the array updates. It’s a great exercise in understanding flow control and direction-based simulation, where small logical errors can change the entire outcome. Patience and precision made all the difference here. 🔹 Approach: Simulated each possible starting point and direction, tracking movements and reversals until all elements became zero. Focus was on correctness and clear logic rather than over-optimization. ⚙️ Language: Java ⚡ Runtime: 100 ms (Beats 23.49%) 💾 Memory: 43.44 MB (Beats 13.25%) ✅ Result: 584 / 584 test cases passed — Accepted 🎯 Each solved problem reminds me how logic, structure, and consistency build stronger foundations for solving complex challenges ahead 💪 #100DaysOfCode #LeetCode #Java #CodingChallenge #ProblemSolving #Programming #DeveloperJourney #TechMindset #LearningEveryday #Consistency #Simulation
To view or add a comment, sign in
-
-
Day 38 of #100daysOfCode Problem: 3542. Minimum Operations to Convert All Elements to Zero Difficulty: Medium Language: Java Status: Solved Problem Summary: You are given an integer array nums. In one operation, you can select a subarray [i, j] and set all occurrences of the minimum non-zero integer in that subarray to 0. Your goal is to make all elements zero in the minimum number of operations. Key Insight: This problem can be reduced to tracking how many times the current subarray’s minimum changes. A monotonic stack efficiently tracks the increasing sequence of elements. Each time a smaller element is encountered, it indicates that a set of operations can be completed (popped from stack). What I Learned: Monotonic stacks aren’t just for “next greater” or “next smaller” problems—they can also represent layers of operations or intervals. Elegant one-pass logic using stack simulation can drastically simplify range operation problems. #Day38 #100DaysOfCode #LeetCode #DSA #MonotonicStack #Java #Algorithms #ProblemSolving #CodingChallenge #SoftwareEngineering #LearnByCoding
To view or add a comment, sign in
-
-
Day 17 of My Java Deep Dive: Mastering Factory Pattern, Reflection API, and RTTI! 🚀 Factory Pattern, Reflection API, and Run-Time Type Information (RTTI). These are reshaping how I approach flexible, dynamic code—feels like leveling up in a video game! 🎮 Factory Pattern: I love how it abstracts object creation for cleaner, extensible code. Picture a ShapeFactory that dynamically produces Circles or Squares without hardcoding—pure polymorphism magic! 🛠️ Reflection API: Unlocking runtime introspection to inspect and invoke classes/methods on the fly. It's like peeking under the hood of your code—super powerful for frameworks, but I've learned to handle it carefully to dodge security pitfalls. RTTI: Essential for safe type checks at runtime with instanceof and getClass(). No more dreaded ClassCastExceptions crashing the party! 🔍 Combining them? A factory powered by reflection for dynamic instantiation is next-level. Grateful for those "aha" moments—Java keeps blowing my mind. What's your go-to Java pattern or API, and why? Drop it in the comments! Let's connect, share tips, and grow together. 💬 #Java #DesignPatterns #ReflectionAPI #RTTI #Programming #SoftwareEngineering #TechJourney #CodingJourney #Keep crushing it! 🚀
To view or add a comment, sign in
-
🚀 Custom Annotation + AOP in Spring Boot (Clean & Powerful Combo) Ever wanted to run common logic (like logging, validation, or performance tracking) without cluttering your main code? That’s where Custom Annotations with AOP (Aspect-Oriented Programming) shine. ✅ How it works: • Create a custom annotation → e.g. @LogExecutionTime • Create an Aspect class using @Aspect → intercept methods annotated with it • Use Around Advice → execute logic before & after the actual method 🧠 Result: Every method marked with @LogExecutionTime automatically logs how long it took — clean, reusable, and zero duplicate code. #SpringBoot #Java #AOP #CleanCode #AnnotationMagic
To view or add a comment, sign in
-
-
🔥 Day 17 of My LeetCode Journey — Problem #377: Combination Sum IV (Dynamic Programming) Today’s focus was on Dynamic Programming — specifically tackling problems where order matters in combinations. 🧩 Problem Summary: Given an array of distinct integers and a target integer, the task was to compute the number of possible combinations that sum up to the target. 💡 Approach & Key Insights: Utilized bottom-up Dynamic Programming (1D array approach) to efficiently compute results. Base case: dp[0] = 1, representing one way to reach a sum of zero. Iteratively built combinations where the sequence order impacts the outcome, differentiating it from subset problems. ⚙️ Algorithmic Complexity: Time: O(n × target) Space: O(target) 📈 Performance Outcome: ✅ Accepted Solution ⚡ Runtime: 1 ms (Beats 67.14% of Java submissions) 💾 Memory: 41.19 MB Each day’s challenge continues to refine my analytical reasoning and problem-solving efficiency, bringing me one step closer to mastering algorithmic design patterns in Java. #LeetCode #Java #DynamicProgramming #CodingJourney #ProblemSolving #TechLearning #SoftwareEngineering
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