I don't understand how I'm right


#1



Boolean Operators: Precedence


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

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

	}
}


Becuase the '&&' and '||' displaying true; so why does the '!' over power them


#2

The ! operator represents not if your code was to be written using the booleans it would be,

!(true || (true && true));


#3

Alright... I see. But what I don't understand now is why "1 < 8" and "5 > 2" has parenthesis on the left but "3 < 5" doesn't.


#4

Wait... Never mind. I get it now.


#5

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