-
Notifications
You must be signed in to change notification settings - Fork 0
/
invoking.java
66 lines (49 loc) · 868 Bytes
/
invoking.java
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
class one
{
int var1=23;
two var2;
one( two var2) {
this.var2 = var2;
}
void dis()
{
var2.dis();
System.out.println("value of object 1 frm 2: "+var2.var2);
}
}
class two {
int var2=43;
three var3;
two(three var3) {
this.var3 = var3;
}
void dis()
{
System.out.println("value of object 2 : "+var2);
}
void display()
{
var3.display();
System.out.println("value of object 2 from 3 : "+var3.var3);
}
}
class three {
int var3;
three(int var3) {
this.var3 = var3;
}
void display()
{
System.out.println("value of object 3 : "+var3);
}
}
class invoking
{
public static void main( String[] args) {
three obj3 = new three(222);
two obj2 = new two(obj3);
one obj = new one(obj2);
obj2.display();
obj.dis();
}
}