---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 22 Edition"
java_version: 22
chapter: "Chapter 4. Types, Values, and Variables"
section: "4.1"
heading: "4.1. The Kinds of Types and Values"
parent: "Chapter 4. Types, Values, and Variables"
source: https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-4.1
id: "4.1"
url: https://jvm.obfuscated.software/jls/se22/4.1.html
raw: https://jvm.obfuscated.software/jls/se22/4.1.md
---

# 4.1. The Kinds of Types and Values

There are two kinds of types in the Java programming language: primitive types ([§4.2](4.2.md)) and reference types ([§4.3](4.3.md)). 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](4.2.md)) and reference values ([§4.3](4.3.md)).

```
Type:
  PrimitiveType
  ReferenceType
```

There is also a special *null type*, the type of the expression `null` ([§3.10.8](3.10.8.md), [§15.8.1](15.8.1.md)), 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.2.md), [§5.3](5.3.md), [§5.5](5.5.md)).

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.
