Java OCA OCP Practice Question 1143

Question

Which of the following best describes the flow of execution in this for loop if B always returns false?

for (A; B; C) { 
       D; 
} 
  • A. A
  • B. A, B
  • C. A, B, C
  • D. None of the above


B.

Note

The initializer, which is A, runs first.

Then Java checks the condition, which is B, to see if loop execution should start.

Since B returns false, the loop is never entered, and Option B is correct.




PreviousNext

Related