What will happen when you attempt to compile and run the following code?
public class test{
static{
int x=5;
}
static int x,y;
public static void main(String args[]){
x--;
myMethod( );
System.out.println(x+y+ ++x);
}
public static void myMethod( ){
y=x++ + ++x;
}
}
A compiletime error
B prints:1
C prints:2
D prints:3
E prints:7
prints:8
|
|