package com;
/**
* @filename New.java
*
* @author xie hongwei
* @email 936254341@qq.com
* @date 2014-12-30下午11:39:16
* @version 1.0
*/
public class NewTest extends A{
static {
System.out.println("***** static *****");
}
{
System.out.println("***** NewTest *****");
}
public NewTest(){
System.out.println("***** New constructor *****");
}
public static void main(String[] args) {
NewTest nt = new NewTest();
}
}
class A{
static {
System.out.println("*****A -- static*****");
}
{
System.out.println("*****A -- unstatic*****");
}
public A(){
System.out.println("*****A -- constructor *****");
}
}
结果:
*****A -- static*****
***** static *****
*****A -- unstatic*****
*****A -- constructor *****
***** NewTest *****
***** New constructor *****