Menu
Question Index
...

Which of the following statement(s) is/are correct?

1. If a is false and b is true, then the output is ELSE
2. If a is true and b is false, then the output is notB
3. If a is true and b is true, then the output is A && B
4. If a is false and b is false, then the output is ELSE

public void output(boolean a, boolean b) {
    if (a && b) {
        System.out.println("A && B");
    } else if (a) {
        System.out.println("A");
    } else {
        if (!b) {
            System.out.println("notB");
        } else {
            System.out.println("ELSE");
        }
    }
}


1, 2 & 3
2, 3 & 4
2 & 4
1 & 3
All of the above
None of the above

Doubts

Problems

Topic: if else if ladder 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