Menu
Topics Index
...
`

If condition1955


If you need explanation Read this topic

If you need Answer Take test on this topic

If condition1955
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");
        }
    }
}

A. 1, 2 & 3
B. 2, 3 & 4
C. 2 & 4
D. 1 & 3
E. All of the above
F. None of the above
Topic: if else if ladder In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

ans is D as for the second statement output must be A and for fourth output must be notB

Posted by Pramod Jain    2013-11-21 08:46:38


Ans is D...only those satisy

Posted by Santosh Munugota    2013-11-21 09:06:15


Congratulations Pramod Jain. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2013-11-22 03:31:34


thank u mc :) got rc :) :)

Posted by Pramod Jain    2013-12-03 04:34:55


© meritcampus 2019

All Rights Reserved.

Open In App