abstract class base
{
public int age=getNumber(100);
static
{
System.out.println("base static block");
}
{
System.out.println("base nonstatic block");
}
static int sage=getNumber(50);
base()
{
System.out.println(age);
System.out.println("base start");
draw();
System.out.println("base end");
}
static int getNumber(int base)
{
System.out.println("base.getNumber int:"+base);
return base;
}
public void draw()
{
System.out.println("base.draw");
}
}
class initializeOrder extends base{
public int age=getNumber(1001);
private int _radius=getNumber(10);
static int sage=getNumber(250);
static
{
System.out.println("subclass static block");
}
{
System.out.println("subclass nonstatic block");
}
initializeOrder(int radius)
{
_radius=radius;
System.out.println(age);
draw();
System.out.println("initializeOrder initialized");
}
public void draw()
{
System.out.println("initializeOrder.draw "+_radius);
}
public static void main(String[] args)
{
new initializeOrder(1000);
}
} |
|