boolean a = true;
boolean b = false;
boolean c = true;
boolean r = a || b && c;
System.out.println(r);What is printed?
- A
a
- B
compile error
- C
false
- Dcheck_circle
true
Explanation
&& has higher precedence than ||, so this is a || (b && c) = true || (false && true) = true || false = true.