class Insect {
private int i = 1;
protected int j;
Insect() {
System.out.println("i = " + i + ", j = " + j);
j = 1;
}
private static int x1 = print("static Insect.x1 initialized");
static int print(String s) {
System.out.println(s);
return 0;
}
}
class Beetle extends Insect {
private int k = print("Beetle.k initialized");
public Beetle() {
System.out.println("k = " + k);
System.out.println("j = " + j);
}
private static int x2 = print("static Beetle.x2 initialized");
}
public class MainClass {
public static void main(String[] args) {
Beetle b = new Beetle();
}
}
|