请问dsa,
c为什么不对呢?是default constructor呀!

解决方案 »

  1.   

    c,e
    d不对 ,是因为在构造器中可以initializes the instance variables declared in the class.
    并不意味着缺省构造器中一定会initializes the instance variables declared in the class.
    事实上initializes the instance variables declared in the class.是系统自动的行为,你就是自己建一个构造器,不做任何操作,系统也会initializes the instance variables declared in the class.
      

  2.   

    不一定,至少在 j2me 的源代码中,所有类变量如果没有赋值的话,会在缺省构造方法中给它们赋值。
    我不知道分析 java 伪代码,谁懂的,可以分析一下,看看是不是真的。e 也是错的,任何一个类,不管你自定义的构造方法是怎样的,肯定有一个不带参数的缺省构造方法的,这是我的观点。
      

  3.   

    我同意选c,e,因为类变量是在jvm装载类的时候自动初始化的.
      

  4.   

    是我错了,e 是对的。
    不过在 j2me 的 class 中,成员变量初始化好像是放在缺省构造方法中的。
      

  5.   

    c,e对
    d:那不是缺省构造函数做的事情。一个对象即使用特定的构造函数创建,也会初始化实例变量
      

  6.   

    无参数构造顺序.
    (1)成员(fields)设成初始值。(0,false,null)
    (2)调用(call)构造函数(但不执行构造函数体)。
    (3)激活(invoke)父类的构造函数。
    (4)执行构造函数体。
      

  7.   

    加深一下印象.说说以下的结果.
    class A 
    {
       int a = f();
       int f() 
       {
          return 1;
       }
    }class B extends A 
    {
         int b = a;
         int f()
         {
           return 2;
         }
    }public class CtorDemo1 {
    public static void main(String args[]) {
    B bobj = new B();
    System.out.println(bobj.b);
    }
    }