-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathISADemo2.java
More file actions
45 lines (42 loc) · 707 Bytes
/
Copy pathISADemo2.java
File metadata and controls
45 lines (42 loc) · 707 Bytes
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
class A{
int x;
int y;
A(){
x = 1;
System.out.println("A Default Cons");
}
}
class B extends A{
int x;
B(){
super();
x = 2;
System.out.println("B Default Cons");
}
B(int x){
this();
int z = super.x + this.x + x + y;
System.out.println("B Param Cons Call "+z);
}
}
class C extends B{
int x;
C(){
super(100); // parent class constructor call
x = 5;
System.out.println("C Default Cons");
}
C(int x){
this();
//super(200);
// super();
int z = x + this.x + ((B)this).x + ((A)this).x;
System.out.println("C Param Cons Call "+z);
}
}
public class ISADemo2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
C c = new C(100);
}
}