A

Admin • 828.43K Points
Coach

Q. What will the following print?
int x = 5;
do {
System.out.print(x);
} while(x < 5);

  • (A) 5
  • (B) nothing
  • (C) 6
  • (D) infinite loop
  • Correct Answer - Option(A)
  • Views: 10
  • Filed under category Java
  • Hashtags: Java Loops

Explanation by: Admin
do-while runs once even if the condition is false.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.