If I'm understanding you correctly, you're saying that this will cause an Exception:
String str = null;
boolean n = (str == null);
...and that's simply not true. Using == to check null is the...
Type: Posts; User: KevinWorkman
If I'm understanding you correctly, you're saying that this will cause an Exception:
String str = null;
boolean n = (str == null);
...and that's simply not true. Using == to check null is the...
Using == for null is fine, since you're comparing the reference (as Mr.777 already pointed out). If your reference is null, it will be == to null.
Probably not. But what are you actually trying to do? Why do you think you should be avoiding the == operator in this case?