CODE
class PrintNumberRelations
{
public static void main(String arg[])
{
int a = 4;
int b = 1;
boolean x = ( a > b );
boolean y = ( a <= b );
boolean z = ( a == b );
System.out.println(" The statement - a greater than b - is " + x);
System.out.println(" The statement - a is less than or equal to b - is " + y);
System.out.println(" The statement - a is equal to b - is " + z);
}
}
The statement - a greater than b - is true
The statement - a is less than or equal to b - is false
The statement - a is equal to b - is false
Here the relation between a
and b
is found using various relational operators. x
tells if a
is greater than b
(a > b
), y
tells if a
is less than or equal to b
(a <= b
) and z
tells if a
and b
are equal (a == b
).
boolean w
which tells if a
greater than or equal to b
and print the result.boolean v
which tells if a
is not equal to b
and print the result.boolean u
which tells if ((a + 2) * 3)
is less than ((b + 1) * 9)
and print the result.