So the assignment is: “Line 4 has a code statement that is incomplete. Use each Boolean operator no more than once to replace the empty comments /**/. The code statement should print out false.”
So i wrote it like this:
boolean riddle = !( 1 < 8 && (5 > 2 || 3 < 5));
System.out.println(riddle);
and that’s correct, this prints out ‘false’, but i don’t understand how.
First, 1 is less than 8 so the ! returns out opposite, which is false.
Then, 1 is less than 8 is true and 5 is larger than 2 is also true, so the && should print out true (?)
But then, 5 is bigger than 2 as well as 3 being less than 5, so the || should also print out true (?)
So how does all this print out false? When both && and || is true ?
What have i been mising?