operators/flow control Flashcards
1
Q
Will a post-increment produce a different output than the pre-increment in the following for loop?
(for int i = 0; i < 10; ++i) { System.out.println(i): }
A
Nope, it sure won’t.
The flow goes like:
- test the condition
- if it is false, terminate
- if it is true, execute the body
- execute the incrementation step
2
Q
Does the following compile?
System.out.println(null + null);
A
No.
Only if it were concatenating to a string will null not cause compilation error.