-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBeetle.java
More file actions
34 lines (25 loc) · 767 Bytes
/
Beetle.java
File metadata and controls
34 lines (25 loc) · 767 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
class Insect {
private int i = 9;
protected int j;
Insect() {
System.out.println("i = " + i + ", j = "+ j);
j = 39;
}
private static int x1 = printInit("Field static Insect x1 initialized");
static int printInit(String s) {
System.out.println(s);
return 47;
}
}
public class Beetle extends Insect {
private int k = printInit("Field Beetle k initialized");
public Beetle() {
System.out.println("k = " + k);
System.out.println("j = " + j);
}
private static int x2 = printInit("Field static Beetle x2 initialized");
public static void main(String[] args) {
System.out.println("Constructor Beetle");
Beetle b = new Beetle();
}
}