A

Admin • 828.43K Points
Coach

Q. What will be the output of this code?
for (int i = 0; i < 5; i++) {
if (i == 3) break;
System.out.print(i);
}

  • (A) 01234
  • (B) 0123
  • (C) 012
  • (D) 1234
  • Correct Answer - Option(C)
  • Views: 36
  • Filed under category Java
  • Hashtags: Java Loops

Explanation by: Admin
When i becomes 3, break is executed, so output is 0, 1, 2.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.