Question

What is the output of the following Java code?     public class LoopTest {         public static void main(String[] args) {             int x = 0;             while (x < 5) {                 x++;                 if (x == 3) {                     break;                 }             }             System.out.println(x);         }     }

B 1
C 2
D 3
E 5
Practice Next

Hey! Ask a query