B
Big D
I'm confused by the output of the following code:
public class PP {
public static void main(String[] args) {
int i = 1;
i = i++;
System.out.println(i);
}
}
It outputs 1.
I understand the assignment operator happening before the ++, but I don't
understand why the ++ doesn't increment. I thought the statement should
basically expand to:
i = i;
i = i+1;
but the ++ gets lots somewhere...
public class PP {
public static void main(String[] args) {
int i = 1;
i = i++;
System.out.println(i);
}
}
It outputs 1.
I understand the assignment operator happening before the ++, but I don't
understand why the ++ doesn't increment. I thought the statement should
basically expand to:
i = i;
i = i+1;
but the ++ gets lots somewhere...