What is the value of the following Java expression, given:
int a = 3, b = 5, c = 4, d = 6;
!(a < b) || c >d
Solution
int a = 3, b = 5, c = 4, d = 6;
!(a < b) || c >d
First (a<b) and (c>d) are calculated:
==> !( 3 < 5) || (4 > 6)
==> !(true) || false
Now !(true) will be evaluated
==> false || false
Now || operator will be evaluated.
==> false.
So the final output will be false.