|
|
|
|
|
by Freak_NL
2966 days ago
|
|
In Java you usually use `.equals()` to test equality, or if your argument is a boolean value: if (myVar) {
//
}
Instead of `myVar == true/false`.The accidental assignment is much less common due to the way equality is tested in Java. Also, `null` comparisons being assigned will fail to compile (assuming var is a String here): TestApp.java:6: error: incompatible types: String cannot be converted to boolean
if (var = null) {
|
|