---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 23 Edition"
java_version: 23
chapter: "Chapter 17. Threads and Locks"
section: "17.4.1"
heading: "17.4.1. Shared Variables"
parent: "17.4. Memory Model"
source: https://docs.oracle.com/javase/specs/jls/se23/html/jls-17.html#jls-17.4.1
id: "17.4.1"
url: https://jvm.obfuscated.software/jls/se23/17.4.1.html
raw: https://jvm.obfuscated.software/jls/se23/17.4.1.md
---

# 17.4.1. Shared Variables

Memory that can be shared between threads is called *shared memory* or *heap memory*.

All instance fields, `static` fields, and array elements are stored in heap memory. In this chapter, we use the term *variable* to refer to both fields and array elements.

Local variables ([§14.4](14.4.md)), formal method parameters ([§8.4.1](8.4.1.md)), and exception handler parameters ([§14.20](14.20.md)) are never shared between threads and are unaffected by the memory model.

Two accesses to (reads of or writes to) the same variable are said to be *conflicting* if at least one of the accesses is a write.
