-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_12_Multilevel_inheritance.java
More file actions
47 lines (46 loc) · 1.06 KB
/
Copy path_12_Multilevel_inheritance.java
File metadata and controls
47 lines (46 loc) · 1.06 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
// 1 super class and multipal sub class line by line.
public class _12_Multilevel_inheritance { // super
int a,b,c;
void add(){
a=10;b=20;
c= a+b;
System.out.println("Sum of two no.: "+c);
}
void sub(){
a=200; b=100;
c= a-b;
System.out.println("Sub of two no.: "+c);
}
}
class twelve extends _12_Multilevel_inheritance{ // sub 1
void multi() {
a = 200;
b = 100;
c = a * b;
System.out.println("Multiplication of two no.: " + c);
}
void div() {
a = 200;
b = 100;
c = a / b;
System.out.println("Division of two no.: " + c);
}
}
class twelve2 extends twelve { // sub2
void rem() {
a = 200;
b = 100;
c = a % b;
System.out.println("reminder of two no.: " + c);
}
}
class test{
public static void main(String[] args) {
twelve2 r = new twelve2();
r.add();
r.sub();
r.multi();
r.div();
r.rem();
}
}