Help:::why it does not work?


#1

public class Precedence {
public static void main(String[] args) {

	boolean riddle = !( 1 < 8 &&(5 > 2 || 3 < 5));
	System.out.println(riddle);

}

}

it always show me : Almost!Did you use each boolean operator no more than one time ..


#2

It won't work because you are trying to print out a boolean. A boolean is either true of false. The easiest way to print out a boolean is to create an if else statement like the following:

if(riddle){
System.out.println("True");
} else {
System.out.println("False");
}

This tells your program to print out True in case riddle is set to true and to print out false in case riddle is set to false