-->
当前位置:首页 > 题库

单选题:What is the result of attempting to compile and run the followin

Luz5年前 (2021-05-10)题库866
What is the result of attempting to compile and run the following program? @[B](2)
```Java
public class Test {
private int i = j;
private int j = 10;
public static void main(String args[]) {
System.out.println((new Test()).i);
}
}
```
A. Compiler error complaining about access restriction of private variables of Test.
B. Compiler error complaining about forward referencing.
C. No error - The output is 0;
D. No error - The output is 10;



A.Compiler error complaining about access restriction of private variables of Test.
B.Compiler error complaining about forward referencing.
C.No error - The output is 0;
D.No error - The output is 10;


答案:B