5.Booleen operators: Precedence


#1

I got the code right but I don't know why and I would like to understand it:

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

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

}

}

Wouldn't the left side give me false, the right side give me true since both sides of the && are true SO false or true would print false? The question says to print true and from my understanding, it has printed false.


#2

@brieahanna,

 !( 1 < 8 || (5 > 2 && 3 < 5))
 !( True  || (True  && True ))
 !( True  ||       True      )
 !(      True                )
         False

https://docs.oracle.com/cd/E17952_01/refman-5.1-en/operator-precedence.html

  1 + 2 *3;        -> 7
 (1 + 2)*3;        -> 9

5/11 Boolean operators presedence