Step by step learning
boolean flag = false; if (flag = true) { }
What is true for this expression?
The code will compile and run and the if verification succeeds.
Compilation error as an assignment (=) is used instead of an equality test (==).
The code will compile and run. But the if verification fails because flag is false.
Please log in or register to have a possibility to add comment.
Please log in or register to have a possibility to add comment.