public class TestClassInitial {
public static void main (String[] args){
Beetle b=new Beetle();
}
}
class Insect{
private int i=9 ;
protected int j;
Insect(){
System.out .println("i=" +i+", j=" +j);
j=39 ;
}
{
System.out .println(" insect" );
}
private static int x1=printStatic("static Insect.x1 init" );
static {
System.out .println(" static insect" );
}
public static int printStatic (String string ) {
System.out .println(string );
return 1 ;
}
}
class Beetle extends Insect{
private String k="k" ;
static {
System.out .println("static Beetle" );
}
{
System.out .println("Beetle" );
}
public Beetle (){
System.out .println("construct Beetle" );
}
private static int x2=Insect.printStatic("beetle x2" );
}
static Insect.x1 init
static insect
static Beetle
beetle x2
insect
i=9 , j=0
Beetle
construct Beetle