Exercise 5 not letting me pass, even though I did it correctly?


#1

Here is where im stuck. The exercise says to make it print false. I made it print false with no errors after running it but it's not letting me pass the section.

https://www.codecademy.com/en/courses/learn-java/lessons/conditionals-control-flow/exercises/boolean-operators-precedence

I don't believe I did it wrong because it prints false when i run it. Isn't that what's it told me to do?

Here is my code that prints false

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

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

	}
}

#3

What errors did the code give you?


#4

boolean riddle = !(1 < 8 &&(5 > 2 || 3 < 5));
Don't bracket the 1<8, place the bracket around the whole thing. so the ! is for the whole statement


#5

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