不要拿编译器运行,直接写出答案来哦package com.wen.test;public class TestExtends {
public static void main(String[] args) {
A a = new B();
B b = new B();
}
}abstract class A {
abstract void a();
static {
E e = new E();
}
C c = new C();
public A() {
System.out.println("hello,this is a");
a(); }
}class B extends A {
static int b =1;
C c = new C();
 void a() {
System.out.println(b);
}
public B() {
System.out.println("hello,this is b");
}}class C {
public C() {
System.out.println("hello,this is c");
}
}class E {
public E() {
System.out.println("static e");
}
}

解决方案 »

  1.   

    hello,this is a
    b
    hello,this is b
    hello,this is a
    b
    hello,this is b
    好像是这样的
      

  2.   

    啊,忘了b的值了,下边是:
    hello,this is c
    hello,this is b
    hello,this is c
    hello,this is a
    1
    hello,this is c
    hello,this is b
      

  3.   

    static e
    hello,this is c
    hello,this is a
    1
    hello,this is c
    hello,this is b
    hello,this is c
    hello,this is a
    1
    hello,this is c
    hello,this is b
    汗,看看这个
      

  4.   

    static e
    hello,this is a 
    1
    hello,this is c
    hello,htis is bstatic e
    hello,this is a 
    1
    hello,this is c
    hello,htis is b
      

  5.   

    Tnt_ABC 
    static 变量 只加载一次哦。。
      

  6.   

    hello,htis is b
    hello,htis is b
      

  7.   

    感觉是这样 基本顺序如下
    e
    c
    a
    1
    c
    b
    c
    a
    1
    c
    b
      

  8.   

    static e
    hello,this is c
    hello,this is a
    1
    hello,this is c
    hello,this is b
    hello,this is c
    hello,this is a
    1
    hello,this is c
    hello,this is b
      

  9.   

    static e
    hello,this is c
    hello,this is a
    1
    hello,this is c
    hello,this is b
    hello,this is c
    hello,this is a
    1
    hello,this is c
    hello,this is b