Is there ever a situation where using equals(Boolean) and == would return different results when dealing with Boolean objects?
equals(Boolean)
==
Boolean
<
if (Boolean.TRUE == new Boolean(true)) { System.out.println("=="); } if (Boolean.TRUE.equals(myBoolean)) { System.out.println("equals"); }
In this case first one is false. Only second if condition is true.
It Prints:
equals