In Java, a variable is a reference to an object. A null
value thus indicates an unset reference (i.e. a reference to nothing).
You can see variables as containers(*), inside which you can put an object of a given type, when the variable is null
, it means your container is empty. It's obvious that any container can be empty (regardless of the type of object it's supposed to host), you only need to put nothing in it (or removing what was inside).
Nontheless, the void is not an object of any type, it's just what's left when you take the content out of a container.
(*) I do know that containers are not a good abstraction for reference values, but they were good for this specific explanation.