What is the difference between a while loop and a do-while loop in Java?
A. A while loop executes the code block at least once, while a do-while loop may not execute the code block at all.
B. A while loop is more efficient than a do-while loop.
C. A while loop is used for iterating over arrays, while a do-while loop is used for iterating over collections.
D. None of the above.
Answer:A
What is the difference between a while loop and a do-while loop in Java?
A. A while loop executes the code block at least once, while a do-while loop may not execute the code block at all. B. A while loop is more efficient than a do-while loop. C. A while loop is used for iterating over arrays, while a do-while loop is used for iterating over collections. D. None of the above.