-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ9.java
More file actions
40 lines (29 loc) · 669 Bytes
/
Copy pathQ9.java
File metadata and controls
40 lines (29 loc) · 669 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
package Assignment_01;
public class Q9 {
public static void main(String[] args) {
XYZ obj = new XYZ();
obj.showData();
obj.accessData();
}
}
class ABC {
int a = 10;
public int b = 20;
protected int c = 30;
private int d = 40;
void showData() {
System.out.println("Inside class ABC");
System.out.println("a=" + a);
System.out.println("b=" + b);
System.out.println("c=" + c);
System.out.println("d=" + d);
}
}
class XYZ extends ABC {
void accessData() {
System.out.println("Inside class XYZ");
System.out.println("a=" + a);
System.out.println("b=" + b);
System.out.println("c=" + c);
}
}