A

Admin • 832.27K Points
Coach

Q. What will be the output of the following code?
int i = 1;
while(i < 3) {
i++;
}
System.out.print(i);

  • (A) 1
  • (B) 2
  • (C) 3
  • (D) 4
  • Correct Answer - Option(C)
  • Views: 15
  • Filed under category Java
  • Hashtags: Java Loops

Explanation by: Admin

The loop runs until i becomes 3, so 3 is printed.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.