package parent;
public class Child extends Father {
static {
System.out.println("子类静态代码块无变量");
}
static int c = 6;
static {
c = c + 10;
System.out.println("子类静态代码块,c=" + c);
}
public Child() {
c = c + 100;
System.out.println("子类构造函数c=" + c);
}
{
c = c + 1000;
System.out.println("子类构造代码块c=" + c);
}
@Override
public void putong() {
c = c + 500;
System.out.println("子类重写父类的私有普通方法c=" + c);
}
public static void staticMethod() {
c = c + 500;
System.out.println("子类写一个和父类名字一样的静态方法c=" + c);
}
public static void main(String[] args) {
Child child = new Child();
child.putong();
staticMethod();
}
}