What is the result? Given the following main method: What is the result? Given the following main method: What is the result? A. 5 4 3 2 1 0 B. 5 4 3 2 1 C. 4 2 1 D. 5 E. Nothing is printed Show Hint ← Previous question Next question →
Snr DingDong Answer is D. The body of a do-while loop is always executed once. Note that num– doesn’t change num until after its used. So 5 is printed and as the while condition is never true it terminates the loop after its first check. Reply Suckmibaby Correct Reply
Answer is D. The body of a do-while loop is always executed once. Note that num– doesn’t change num until after its used. So 5 is printed and as the while condition is never true it terminates the loop after its first check.
Correct
Indeed, answer is D.