From e26f60e439ffba9cf7ae7ce85fd6ce5131f4e7cd Mon Sep 17 00:00:00 2001 From: Kunal Date: Wed, 11 Feb 2026 16:48:02 +0530 Subject: [PATCH 1/2] Update README to include 'base class' to parent and 'derived class' to child terminology Clarified the definition of subclass in the context of inheritance. --- oop/java/inheritance/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oop/java/inheritance/README.md b/oop/java/inheritance/README.md index 8157db30..2c27115e 100644 --- a/oop/java/inheritance/README.md +++ b/oop/java/inheritance/README.md @@ -2,7 +2,7 @@ ## Introduction -**Inheritance** is one of the core principles of Object-Oriented Programming (OOP). It allows a class (subclass or child class) to acquire the properties and behaviors of another class (superclass or parent class). This promotes **code reuse**, **scalability**, and **maintainability**. +**Inheritance** is one of the core principles of Object-Oriented Programming (OOP). It allows a class (subclass or child class or derived class) to acquire the properties and behaviors of another class (superclass or parent class or base class). This promotes **code reuse**, **scalability**, and **maintainability**. ## **What is Inheritance?** From c6aabf9516284835831d39f65e61c0dae3ee0aed Mon Sep 17 00:00:00 2001 From: Kunal Date: Wed, 18 Feb 2026 20:20:19 +0530 Subject: [PATCH 2/2] Add examples for interface inheritance cases include Diamond Problem (Interface Version) Added examples for inheritance with interfaces, including cases with abstract and default methods. --- oop/java/interfaces/README.md | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/oop/java/interfaces/README.md b/oop/java/interfaces/README.md index a4f0b961..48e65e85 100644 --- a/oop/java/interfaces/README.md +++ b/oop/java/interfaces/README.md @@ -98,6 +98,47 @@ public class FlyingCar implements Flyable, Drivable { } ``` + + +## **Case 1: Inheritance with 2 interfaces have the same ABSTRACT METHODS** + +interface A { + void show(); +} + +interface B { + void show(); +} + +class Test implements A, B { + public void show() { + System.out.println("Implemented once"); + } +} + + +## **Case 2: Inheritance with 2 interfaces have the same DEFAULT METHODS -- [Diamond Problem (Interface Version)]** + +interface A { + void show(); +} + +interface B { + void show(); +} + +class Test implements A, B { + public void show() { + A.super.show(); + B.super.show(); + } +} + +// Diamond Problem (Interface Version) solved. + + + + ### **Usage** ```java public class Main {