You are on page 1of 1

Quiz 2: Selection: Logical Operators in Java 208213

What will be the output of this Java program?

public static void main(String[] args)


{
int x = 1;
int y = 2;
int z = 5;
System.out.println("x: " +(x==1));
System.out.println("y: " +(y==z));
System.out.println("z>x: " +(z>x));
if(x==1 || x>y || x>z)
{
System.out.println("One");
}
if(x==y || y==2 || z==5)
{
System.out.println("Two");
}
if(x==y || y==z || z==x)
{
System.out.println("Three");
}

OUTPUT

x: true
y: false
z>x: true
One
Two

You might also like