Question 54)
What will happen when you attempt to compile and run the following code?
public class Inc{
public static void main(
String argv[]){
Inc inc = new Inc();
int i =0;
inc.fermin(i);
i = i++;
System.out.println(i);
}
void fermin(int i){
i++;
}
}
1) Compile time error
2) Output of 2
3) Output of 1
4) Output of 0
The answer is 4 , it prints 0
If someone can explain in a bit detail why it is printing zero..
why not 1???
Wali