Skip to content

Commit 04badf0

Browse files
committed
OOPS - Inheritance
1 parent 81a4992 commit 04badf0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/OOPS/T9_Inheritance.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package OOPS;
2+
3+
4+
public class T9_Inheritance {
5+
static class Parent {
6+
Parent(int a) {
7+
System.out.println("Parent: " + a);
8+
}
9+
}
10+
static class Child extends Parent {
11+
//** Object class is the cosmic class is the root class of all Java classes
12+
Child() {
13+
this(15);
14+
System.out.println("Child");
15+
}
16+
Child(int a) {
17+
super(a);
18+
}
19+
}
20+
21+
public static void main(String[] args) {
22+
Child obj = new Child();
23+
}
24+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy