Java Boolean Operators

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/en/courses/learn-java/lessons/conditionals-control-flow/exercises/boolean-operators-precedence

<In what way does your code behave incorrectly? Include ALL error messages.>
Almost! Did you use each Boolean operator no more than one time?

```

Replace this line with your code.

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

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

}

}

<do not remove the three backticks above>
1 Like

> is used twice.

** boolean riddle =(!(1 < 8) && (5 > 2 || 3 <= 5));**

Still getting the same error. :frowning:

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

So seemingly you have to many () and I believe you need to call riddle instead of false

Finnally, it’s working. Thanks, :slight_smile:
Thanks to toplearner too for the reply.

1 Like

No problem hope the rest of your coding goes well! :smiley:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.