Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.11 seconds.

  1. Replies
    7
    Views
    2,137

    Re: how to check null

    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...
  2. Replies
    7
    Views
    2,137

    Re: how to check null

    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.
  3. Replies
    7
    Views
    2,137

    Re: how to check null

    Probably not. But what are you actually trying to do? Why do you think you should be avoiding the == operator in this case?
Results 1 to 3 of 3