null
is actually not instanceof
anything!
The instanceof operator from the Java Language Specification (§15.20.2):
At run time, the result of the instanceof operator is true if the
value of the RelationalExpression is not null and the reference
could be cast (§15.16) to the ReferenceType without raising a
ClassCastException. Otherwise the result is false.
4.1. The Kinds of Types and Values
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).
Type:
PrimitiveType
ReferenceType 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.