From 322a812939c259b07c2ca7d60860e0c821dae1a3 Mon Sep 17 00:00:00 2001 From: Abhika Mittal <108512151+Abhika3021@users.noreply.github.com> Date: Fri, 7 Oct 2022 19:25:20 +0530 Subject: [PATCH] Update java.md Added the Inheritance Concept in it. --- java.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/java.md b/java.md index 03ce6bd..965c4c3 100644 --- a/java.md +++ b/java.md @@ -384,3 +384,23 @@ class Child-class extends Parent-Class { //code } ``` +### 6. Inheritance + +Acquiring the properties of an existing object by new objects is called Inheritance. +This is achieved at the class level. + +```java +class AA { +//code +} +class BB extends AA { +//code +} +``` +Class BB is inheriting properties from Class AA. +Class AA is parent of class BB. +Class BB is child of class AA. + +```java + Parent --> Base --> Super + Child --> Derived --> Sub