Menu
Question Index
...

What will be the output of the following program?

public class Switch {
    public static void main(String[] args) {
        boolean lampX = false, result;
        boolean lampY = true;
        result = lampY && lampX;
        System.out.println("Lamp switch-on " + result);
        result = lampY & lampX;
        System.out.println("Lamp switch-on " + result);
    }
}


Lamp switch-on true
Lamp switch-on false
Lamp switch-on false
Lamp switch-on false
Lamp switch-on false
Lamp switch-on true
Compilation Error or Runtime Error

Doubts

Problems

Topic: Short Circuit Logical Operators In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App