---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 10 Edition"
java_version: 10
chapter: "Chapter 15. Expressions"
section: "15.26"
heading: "15.26. Assignment Operators"
parent: "Chapter 15. Expressions"
source: https://docs.oracle.com/javase/specs/jls/se10/html/jls-15.html#jls-15.26
id: "15.26"
url: https://jvm.obfuscated.software/jls/se10/15.26.html
raw: https://jvm.obfuscated.software/jls/se10/15.26.md
---

# 15.26. Assignment Operators

There are 12 *assignment operators*; all are syntactically right-associative (they group right-to-left). Thus, `a=b=c` means `a=(b=c)`, which assigns the value of `c` to `b` and then assigns the value of `b` to `a`.

```
AssignmentExpression:
  ConditionalExpression
  Assignment

Assignment:
  LeftHandSide AssignmentOperator Expression

LeftHandSide:
  ExpressionName
  FieldAccess
  ArrayAccess

AssignmentOperator:
  (one of)
  = *= /= %= += -= <<= >>= >>>= &= ^= |=
```

The result of the first operand of an assignment operator must be a variable, or a compile-time error occurs.

This operand may be a named variable, such as a local variable or a field of the current object or class, or it may be a computed variable, as can result from a field access ([§15.11](15.11.md)) or an array access ([§15.10.3](15.10.3.md)).

The type of the assignment expression is the type of the variable after capture conversion ([§5.1.10](5.1.10.md)).

At run time, the result of the assignment expression is the value of the variable after the assignment has occurred. The result of an assignment expression is not itself a variable.

A variable that is declared `final` cannot be assigned to (unless it is definitely unassigned ([§16 (*Definite Assignment*)](16.md))), because when an access of such a `final` variable is used as an expression, the result is a value, not a variable, and so it cannot be used as the first operand of an assignment operator.

**Sections:**

- [15.26.1. Simple Assignment Operator =](15.26.1.md)
- [15.26.2. Compound Assignment Operators](15.26.2.md)
