Given code:

public class A {
    public static void main(String[] args) {
        boolean a = true;
        boolean b = false;
        boolean c = true;
        if (a || b && c)
        System.out.print("Hello ");
        if (a && !b && c)
        System.out.print("World");	
    }
}
What will be displayed on the console?
Explanation
a || b && c = 
true || false && true = true || false = true

a && !b && c = 
true && !false && true = true && true && true == true
Java
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback