-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path34 .Inheritance.java
More file actions
70 lines (48 loc) · 1.08 KB
/
34 .Inheritance.java
File metadata and controls
70 lines (48 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package test;
import java.util.Arrays;
import java.util.Scanner;
//import javax.swing.*;
//import java.lang.Math;
//import java.util.Random;
//import java.awt.Color; // abstract window toolkit
//import java.util.Arrays;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//import java.util.HashMap;
import java.util.*;
public class main {
// Inheritance .
// Inheritance :
//
public static void main(String[] args) {
// TODO Auto-generated method stub
// Declare the Scanner library
Scanner scanner = new Scanner(System.in);
Grand_Father grand = new Grand_Father();
Father father = new Father();
Son son = new Son();
grand.tall();
father.tall();
son.tall();
son.eyes();
}
}
///// Grand-Father Class
package test;
public class Grand_Father {
public void tall() {
System.out.print("Height is : 180");
}
}
///// Father Class
package test;
public class Father extends Grand_Father {
public void eyes() {
System.out.print("Eyes is : Brown");
}
}
///// Son Class
package test;
public class Son extends Father{
}