Please Explain:
public class Test{
static int total = 10;
public static void main (
String args[]) {
new
Test();
}
public Test() {
System.out.println(" In test ");
System.out.println(this);
int temp = this.total;
if(temp >5) {
System.out.println(temp);
}
}
}
A.Class will not compile
B. Compiler reports error at line 2
C. Compiler reports error at line 9
D. The value 10 is one of the elements printed to standard output
E. Class compiles but generates runtime error
Answer is D. Can somebody explain?
Thanks