boolean b;
if (x == y) b = false;
else b = true;Which one-liner is equivalent?
- A
boolean b = x = y;
- Bcheck_circle
boolean b = x != y;
- C
boolean b = !x == y;
- D
boolean b = x == y;
Explanation
The result is the negation of equality, which is exactly x != y.