标签:extend public 构造函数 string 实例化 span min stat pre
/**
* Created by Administrator on 2017/3/6.
*/
/**
* @author zhenghong
* @date 2017-03-06-22:07
**/
public class TestA {
public static void main(String []args)
{
new B();
}
}
class A
{
static
{
System.out.println("static A");
}
public A()
{
System.out.println("constutor A");
}
{
System.out.println("normal A");
}
}
class B extends A{
static
{
System.out.println("static B");
}
{
System.out.println("normal B");
}
public B()
{
System.out.println("constutor B");
}
}
结果
static A
static B
normal A
constutor A
normal B
constutor B
结论,父类静态--》子类静态--》父类代码块--》父类构造函数--》子类代码块--》子类构造函数
标签:extend public 构造函数 string 实例化 span min stat pre
原文地址:http://www.cnblogs.com/alway-july/p/6512297.html