It's a reference value, not a reference variable. Any variable that is a reference type can have the value null. (In Java, all variables are either reference types or primitive types (int
, char
, float
, etc.). (Well, there are also type variables when you start to talk about generics.)
Here's the relevant part of the Java Language Specification:
There are two kinds of types in the Java programming language: primitive types (§4.2) and reference types (§4.3). There are, correspondingly, two kinds of data values that can be stored in variables, passed as arguments, returned by methods, and operated on: primitive values (§4.2) and reference values (§4.3).
There is also a special null type, the type of the expression null (§3.10.7, §15.8.1), which has no name.
Because the null type has no name, it is impossible to declare a variable of the null type or to cast to the null type.
The null reference is the only possible value of an expression of null type.
The null reference can always undergo a widening reference conversion to any reference type.
In practice, the programmer can ignore the null type and just pretend that null is merely a special literal that can be of any reference type.
EDIT To address your comment: I think the language in "The Java Handbook" is a little off the mark. The value null
is not a reference of type Object
; it is a reference of the null type. The key point from the spec is that "the null reference can always undergo a widening reference conversion to any reference type". This is, in a sense, exactly the opposite of Object
. An Object
reference is the widest type of reference; the null
type is (to also speak a little loosely) the narrowest. In particular, assigning a reference of type Object
to a variable of any other reference type is a narrowing conversion that requires an explicit cast (and can raise a ClassCastException
). Assigning the null
reference to a variable of any reference type never requires a cast and cannot raise an exception.
Note that no named reference type can have the behavior of the null type. There really is no "narrowest type" since the (named) type system in Java does not not have such a thing. It is impossible to define a reference type that is assignable to, say, both a String
variable and a Double
variable. Only the null type has that property. The normal rules for reference type conversion do not allow this, which is why it has a separate rule in the Java Language Specification.