What is the difference between a while loop and a do-while loop in Java?
A. A while loop is executed at least once, while a do-while loop may not be executed at all.
B. A while loop executes its body only if the condition is true, while a do-while loop executes its body at least once, regardless of the condition.
C. A while loop and a do-while loop are the same thing in Java.
D. None of the above.
Answer:B
What is the difference between a while loop and a do-while loop in Java?
A. A while loop is executed at least once, while a do-while loop may not be executed at all. B. A while loop executes its body only if the condition is true, while a do-while loop executes its body at least once, regardless of the condition. C. A while loop and a do-while loop are the same thing in Java. D. None of the above.