Menu
Question Index
...

What will be the output of the following program?

public class WaterInWater {
    public static void main(String[] args) {
        boolean water = true;
        while (water) {
            System.out.println(water);
            while (water) {
                water = false;
                System.out.println(water);
            }
        }
        System.out.println(water);
    }
}


true
false
true
true
false
false
true
true
true
Compilation Error
Runtime Error

Doubts

Problems

Topic: Nested While Loop In Java

Read this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App