sorry,let's continue:class a{
  public static void main(String[] args){
    int a;
    a=a+1;
  }
}
question:what will happen when compile this code?
.
.
.
D does not compile
E complile but throw a compile time errorthe answer is E.can sb tell me what the difference between choise D and E

解决方案 »

  1.   

    in JDK1.3
    the answer may be D.
    It does not compile.
      

  2.   

    bsd is right.the answe is D.sorry for the mistake i made.but what's your mean about "does not compile"?isn't the scaning of the code a behaviour or part of of compile
      

  3.   

    I mean the compiler exit before it create a class file.
    and the prompt is as following:
    -----------
    C:\src>javac testCompile.java
    testCompile.java:4: 变量 a 可能还未被初始化
        a=a+1;
          ^
    1 个错误C:\src>
    ------------
      

  4.   

    对于JAVA而言,局部变量在使用前一定要初始化,它没有缺省值,而是随机的。而实例变量有缺省值,可以不用
      

  5.   

    under what situation will the compiler exit before actually compile or what kind of error can be or can not be a compile time error.