There is also a special null type, the type of the expressionChapter 4. Types, Values, and Variables, 4.1. The Kinds of Types and Values
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 be assigned or cast to any reference type (§5.2, §5.3, §5.5).
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.
The type of a literal is determined as follows:
Chapter 15. Expressions, 15.8.1. Lexical Literals
- The type of the null literal
null(§3.10.7) is the null type (§4.1); its value is the null reference.