Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion oop/java/inheritance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?**

Expand Down
41 changes: 41 additions & 0 deletions oop/java/interfaces/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down