Name ______________________
Assume the following:
int k = 10;
int j = 6;
boolean b = false;
boolean c = true
I.
Show what is printed by
each of the following statements.
System.out.println(
1 > 2 );
System.out.println
( b );
System.out.println
( !b );
System.out.println
( k > j && j != 5 );
System.out.println
( k/2 >= j && j/2 == 3 );
System.out.println
( k > j && c );
System.out.println
( k < j || j != 5 );
System.out.println
( k < j || j == 5 );
System.out.println
( !(k > j && j != 5) );
II. Write an if statement that does the following:
(a) When the variable x is between 3 and 5, print "GREAT".
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
(b) When the variable x is between 3 and 5, print "GREAT". Otherwise, print "NOT SO GOOD"
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
(c) When the variable x is between 3 and 5 print GREAT. If it is 3 or below, print "LITTLE". If it is 5 or greater, print "BIGGER".
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________