-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCClient.java
More file actions
61 lines (48 loc) · 1.17 KB
/
CClient.java
File metadata and controls
61 lines (48 loc) · 1.17 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
package lecture9a14;
import java.util.Stack;
/**
* @author Garima Chhikara
* @email garima.chhikara@codingblocks.com
* @date 01-Jan-2019
*
*/
public class CClient {
public static void main(String[] args) {
// case 1
P obj1 = new P();
System.out.println(obj1.d);
System.out.println(obj1.d1);
obj1.fun();
obj1.fun1();
// System.out.println(obj1.d2);
// case 2
P obj2 = new C();
System.out.println(obj2.d); // 10
System.out.println(((C) obj2).d); // 100
System.out.println(obj2.d1); // 20
System.out.println(((C) obj2).d2); // 200
obj2.fun(); // C fun
((P) obj2).fun(); // C fun
obj2.fun1(); // P fun
((C) obj2).fun2(); // C fun2
// case 3
// C obj3 = new P() ;
// System.out.println(obj3.d);
// System.out.println(obj3.d2);
// case 4
C obj4 = new C();
System.out.println(obj4.d); // 100
System.out.println(((P) obj4).d); // 10
System.out.println(obj4.d1); // 20
System.out.println(obj4.d2); // 200
obj4.fun();
obj4.fun1();
obj4.fun2();
Stack<Integer> stack = new Stack<>();
stack.push(10);
stack.push(20);
System.out.println(stack.pop());
System.out.println(stack.size());
System.out.println(stack);
}
}