Can an object be null in Java?

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 must use the literal null provided by the compiler.

Leave a Reply

Your email address will not be published. Required fields are marked *