About 20,100,000 results
Open links in new tab
  1. What is null in Java? - Stack Overflow

    Apr 25, 2010 · In Java (tm), "null" is not a keyword, but a special literal of the null type. It can be cast to any reference type, but not to any primitive type such as int or boolean.

  2. Best way to check for null values in Java? - Stack Overflow

    Before calling a function of an object, I need to check if the object is null, to avoid throwing a NullPointerException. What is the best way to go about this? I've considered these methods. Whic...

  3. Java null check why use == instead of .equals() - Stack Overflow

    In Java I am told that when doing a null check one should use == instead of .equals(). What are the reasons for this?

  4. java - What does null mean? - Stack Overflow

    Oct 12, 2013 · Formally, null is a singleton member of the null type, which is defined to be the subtype of every other Java type. null is a reference type and its value is the only reference value which doesn't …

  5. java - What is a NullPointerException, and how do I fix it? - Stack ...

    If a reference variable is set to null either explicitly by you or through Java automatically, and you attempt to dereference it you get a NullPointerException. The NullPointerException (NPE) typically …

  6. How do I avoid checking for nulls in Java? - Stack Overflow

    If null is a valid response, you have to check for it. If it's code that you do control, however (and this is often the case), then it's a different story. Avoid using nulls as a response. With methods that return …

  7. Can an int be null in Java? - Stack Overflow

    In Java, int is a primitive type and it is not considered an object. Only objects can have a null value. So the answer to your question is no, it can't be null. But it's not that simple, because there are objects …

  8. java - How to check if an int is a null - Stack Overflow

    Dec 7, 2012 · In Java there isn't Null values for primitive Data types. If you need to check Null use Integer Class instead of primitive type. You don't need to worry about data type difference. Java …

  9. How to handle “int i != ""” or “int i != null” statements in Java?

    As we know int is a primitive data type and cannot be null. In my program i want to do a condition check like int i != "" but it says operator != cannot be applied to int,null.

  10. java - Is null an Object? - Stack Overflow

    Dec 13, 2009 · According to the Java spec, null is a type that can be assigned to an object variable (as a value as noted in the comment). You cannot instantiate or create variables of this type though, you …