Inheritance is one of the core ideas in object oriented programming that allows a class to reuse the properties and behaviour of another class. Instead of rewriting the same logic again, a new class can extend an existing one. Things that became clear : • inheritance allows one class to acquire the properties and methods of another class • the class that provides the features is called the parent or base class • the class that inherits those features is called the child or derived class • the extends keyword is used to create this relationship in Java • it helps promote code reuse and cleaner program structure A simple example helps illustrate the idea : class Person { String name; int age; } class Student extends Person { int marks; } In this case the Student class automatically gets the name and age properties from the Person class while also adding its own data. This structure helps avoid repeating code and keeps related behaviour organized through class relationships. #java #oop #programming #learning #dsajourney
Lakhyadeep Sen’s Post
More Relevant Posts
-
🚀 Day 5/45 – Mastering Loops in Java On Day 5 of my Java learning journey, I explored one of the most important concepts in programming — Loops. Loops allow us to execute a block of code multiple times, which is essential for solving real-world problems efficiently. 📚 What I Learned Today Today I learned about: ✔ for loop for controlled iterations ✔ while loop for condition-based execution ✔ do-while loop which executes at least once These concepts helped me understand how repetition works in programming. 💻 Practice Work To apply my learning, I implemented: • Printing numbers from 1 to 10 • Calculating the sum of first 10 numbers • Generating multiplication tables • Creating star patterns using nested loops 🎯 Key Takeaway Loops are extremely powerful and help reduce repetitive code. Understanding loops is essential for solving complex problems and building efficient programs. Daily practice is helping me improve my logical thinking. #Java #Programming #LearningInPublic #CodingJourney #SoftwareDevelopment #Consistency
To view or add a comment, sign in
-
Another key idea in object oriented programming is abstraction. Abstraction focuses on exposing only the essential behaviour of an object while hiding the internal implementation details. In Java, one way to achieve abstraction is through abstract classes. Things that became clear : • an abstract class cannot be instantiated directly • abstract classes can contain both abstract methods and normal methods • abstract methods declare behaviour but do not provide implementation • child classes must provide implementation for the abstract methods • this allows a common structure while letting subclasses define specific behaviour A simple example helps illustrate the idea : abstract class Bird { abstract void fly(); } class Sparrow extends Bird { void fly() { System.out.println("Sparrow flying"); } } Here the Bird class defines the idea of flying, but the actual behaviour is implemented by the specific type of bird. This approach helps separate what an object does from how it actually performs the task. #java #oop #programming #learning #dsajourney
To view or add a comment, sign in
-
Completed the object oriented programming section in Java. At the beginning it felt like a collection of separate topics, but while going through the concepts step by step it became clearer how everything connects. Things that stood out while learning this section : - classes and objects form the basic structure of object oriented programs - variables, constructors, and access modifiers help control how objects are created and how data is accessed - encapsulation protects internal data and allows controlled interaction - inheritance allows classes to reuse behaviour instead of rewriting logic - polymorphism makes programs more flexible by allowing the same operation to behave in different ways - abstraction helps focus on what an object does rather than how it does it One noticeable shift was moving from thinking about programs as a sequence of steps to thinking about them as groups of interacting objects. The concepts are simple individually, but together they create a much more organized way of designing programs. #java #oop #programming #learning #dsajourney
To view or add a comment, sign in
-
Day 38 of My Java Learning Journey Today I explored an important Object-Oriented Programming concept: Aggregation and Composition. Both represent “Has-A” relationships between objects, but they differ in how strongly objects depend on each other. 🔹 Aggregation (Loose Coupling) One object contains another object. The contained object can exist independently. Example: Mobile and Charger A charger can exist even without a mobile. 🔹 Composition (Tight Coupling) One object is strongly dependent on another. The contained object cannot exist independently. Example: Mobile and Operating System (OS) An OS cannot function without the mobile. 📌 Key Idea Aggregation → Loose bound Has-A relationship Composition → Tight bound Has-A relationship 💻 What I Practiced Today ✔ Created classes for OS, Charger, and Mobile ✔ Implemented Has-A relationships using objects ✔ Understood how composition and aggregation work in real code ✔ Practiced with a UML diagram representation 🧠 Real-world Example A Student has a Heart and Brain → Composition (cannot exist separately) A Student has a Bike or Book → Aggregation (can exist independently) #Java #OOP #Programming #JavaDeveloper #LearningJourney #ObjectOrientedProgramming #Aggregation #Composition
To view or add a comment, sign in
-
-
🚀 Understanding Composition vs Aggregation in Java (OOP Concept) As part of my Full Stack Developer learning journey, I practiced an important Object-Oriented Programming concept — Association, which includes Composition and Aggregation. 🔹 Composition (Strong Relationship) In this example, a Student has a Heart and Brain. These objects are created inside the Student class, meaning they cannot exist independently without the Student. 🔹 Aggregation (Weak Relationship) A Student has a Bike and a Book, but these objects are created outside the Student class and passed as parameters. They can exist independently even if the Student object is destroyed. 💡 Key Learning: ✔ Composition → Strong ownership ✔ Aggregation → Weak association ✔ Helps design clean, modular, and reusable code This small project helped me clearly understand how real-world relationships can be modeled using Java OOP principles. TAP Academy Sharath R Harshit T Somanna M G #Java #ObjectOrientedProgramming #OOP #Composition #Aggregation #JavaDeveloper #FullStackDeveloper #Programming #Coding #SoftwareDevelopment #LearningJourney #100DaysOfCode 🚀
To view or add a comment, sign in
-
🚀 Learning OOP Concept: Polymorphism in Java Today, I explored one of the core concepts of Object-Oriented Programming — Polymorphism. 🔹 What is Polymorphism? Polymorphism means “one object, many forms.” It allows methods to perform different tasks based on the object that is calling them. 🔹 Types of Polymorphism: 1. Compile-time (Method Overloading) Same method name, different parameters. 2. Runtime (Method Overriding) Same method name, same parameters, but different implementation in child classes. 🔹 Why is it important? ✔ Improves code flexibility ✔ Enhances reusability ✔ Supports dynamic behavior in applications 🔹 Simple Example: A method "draw()" can behave differently for shapes like Circle, Square, and Triangle. 💡 This concept plays a major role in writing scalable and maintainable applications. Excited to keep learning and building more with Java! ☕ #Java #OOP #Polymorphism #Programming #LearningJourney #SoftwareDevelopment
To view or add a comment, sign in
-
-
🚀 Day 15/45 – Understanding Polymorphism in Java On Day 15 of my Java learning journey, I explored Polymorphism, one of the key pillars of Object-Oriented Programming. Polymorphism allows the same method to behave differently based on the context, making code more flexible and reusable. 📚 What I Learned Today Today I learned: ✔ What polymorphism is and why it is important ✔ Method overloading (compile-time polymorphism) ✔ Method overriding (runtime polymorphism) ✔ Difference between overloading and overriding 💻 Practice Work To apply my learning, I implemented: • A method overloading example using different parameters • A method overriding example using inheritance 🎯 Key Takeaway Polymorphism improves code flexibility and helps in designing scalable applications. It allows developers to use a single interface with multiple implementations. Understanding these OOP concepts step by step is strengthening my programming foundation. #Java #Programming #LearningInPublic #CodingJourney #SoftwareDevelopment #OOP
To view or add a comment, sign in
-
🚀 Understanding Object-Oriented Programming (OOP) Basics Object-Oriented Programming is one of the most important concepts in modern software development. Here’s a simple breakdown: 🔹 Class – A blueprint or template used to create objects. 🔹 Object – A real-world instance of a class. 🔹 Field / Property (Data) – The attributes that define the state of an object. 🔹 Method (Behavior / Action) – The functions that define what an object can do. OOP helps in writing clean, reusable, and organized code. Mastering these fundamentals builds a strong foundation for languages like Java, C++, Python, and more. 💡 Keep learning. Keep building. #ObjectOrientedProgramming #OOP #Java #Programming #SoftwareDevelopment
To view or add a comment, sign in
-
-
Understanding Constructors in Java – A Key OOP Concept As part of strengthening my Object-Oriented Programming (OOP) fundamentals, I explored the concept of Constructors in Java and created this infographic to simplify the topic. 🔹 What is a Constructor? A constructor is a special method in Java used to initialize objects when they are created. It has the same name as the class and does not have a return type. 🔹 Types of Constructors Covered • Default Constructor • Parameterized Constructor • Copy Constructor (conceptual understanding) 🔹 Key Takeaways ✔ Constructors are called automatically when an object is created ✔ They help initialize object data efficiently ✔ Parameterized constructors allow dynamic initialization ✔ Understanding constructors improves object-oriented program design I also included a comparison between constructors and methods to highlight their differences clearly. Creating learning visuals like this helps me strengthen my understanding while sharing knowledge with others in the developer community. #Java #OOP #Constructors #Programming #SoftwareDevelopment #LearningJourney #JavaDeveloper #Coding #TapAcademy TAP Academy
To view or add a comment, sign in
-
-
🚀 Day 12/45 – Understanding Constructors in Java On Day 12 of my Java learning journey, I explored the concept of Constructors, which play an important role in object initialization. Constructors are automatically called when an object is created and help in assigning initial values to object properties. 📚 What I Learned Today Today I learned: ✔ What constructors are and how they work ✔ Difference between constructors and methods ✔ Default constructors ✔ Parameterized constructors for initializing values 💻 Practice Work To apply my learning, I implemented: • A program using a default constructor • A program using a parameterized constructor • Creating multiple objects with different values 🎯 Key Takeaway Constructors make object creation more efficient and organized by initializing data at the time of object creation. This concept is very important for building structured and scalable applications. Learning OOP step by step is making programming more interesting. #Java #Programming #LearningInPublic #CodingJourney #SoftwareDevelopment #OOP
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