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

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)