A.class
public class A {
{
System.out.println("A 方法快 before");
}
public A(){
System.out.println("A 构造方法");
}
public A(int i){
System.out.println("A 有参数构造方法" + i);
}
{
System.out.println("A 方法快 after");
}
static {
System.out.println("A 静态块");
}
}
B.java
public class B extends A {
public B(){
System.out.println("B 构造方法");
}
public B(int i){
System.out.println("B有参数构造方法" + i);
}
{
System.out.println("B 方法快");
}
static {
System.out.println("B static");
}
public static void main(String[] args) {
System.out.println("00000");
A a1=new B();
System.out.println("11111");
B a2=new B();
System.out.println("22222");
B a3=new B(1);
}
}