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

# Chapter 4. Types, Values, and Variables

The Java programming language is a *statically typed* language, which means that every variable and every expression has a type that is known at compile time.

The Java programming language is also a *strongly typed* language, because types limit the values that a variable ([§4.12](4.12.md)) can hold or that an expression can produce, limit the operations supported on those values, and determine the meaning of the operations. Strong static typing helps detect errors at compile time.

The types of the Java programming language are divided into two kinds: primitive types and reference types. The primitive types ([§4.2](4.2.md)) are the `boolean` type and the numeric types. The numeric types are the integral types `byte`, `short`, `int`, `long`, and `char`, and the floating-point types `float` and `double`. The reference types ([§4.3](4.3.md)) are class types, interface types, and array types. There is also a special null type. An object ([§4.3.1](4.3.1.md)) is a dynamically created instance of a class type or a dynamically created array. The values of a reference type are references to objects. All objects, including arrays, support the methods of class `Object` ([§4.3.2](4.3.2.md)). String literals are represented by `String` objects ([§4.3.3](4.3.3.md)).

**Sections:**

- [4.1. The Kinds of Types and Values](4.1.md)
- [4.2. Primitive Types and Values](4.2.md)
- [4.3. Reference Types and Values](4.3.md)
- [4.4. Type Variables](4.4.md)
- [4.5. Parameterized Types](4.5.md)
- [4.6. Type Erasure](4.6.md)
- [4.7. Reifiable Types](4.7.md)
- [4.8. Raw Types](4.8.md)
- [4.9. Intersection Types](4.9.md)
- [4.10. Subtyping](4.10.md)
- [4.11. Where Types Are Used](4.11.md)
- [4.12. Variables](4.12.md)
