---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 15 Edition"
java_version: 15
chapter: "Chapter 15. Expressions"
section: "15.1"
heading: "15.1. Evaluation, Denotation, and Result"
parent: "Chapter 15. Expressions"
source: https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.1
id: "15.1"
url: https://jvm.obfuscated.software/jls/se15/15.1.html
raw: https://jvm.obfuscated.software/jls/se15/15.1.md
---

# 15.1. Evaluation, Denotation, and Result

When an expression in a program is *evaluated* (*executed*), the result denotes one of three things:

- A variable ([§4.12](4.12.md)) (in C, this would be called an *lvalue*)
- A value ([§4.2](4.2.md), [§4.3](4.3.md))
- Nothing (the expression is said to be void)

If an expression denotes a variable, and a value is required for use in further evaluation, then the value of that variable is used. In this context, if the expression denotes a variable or a value, we may speak simply of the *value* of the expression.

Value set conversion ([§5.1.13](5.1.13.md)) is applied to the result of every expression that produces a value, including when the value of a variable of type `float` or `double` is used.

An expression denotes nothing if and only if it is a method invocation ([§15.12](15.12.md)) that invokes a method that does not return a value, that is, a method declared `void` ([§8.4](8.4.md)). Such an expression can be used only as an expression statement ([§14.8](14.8.md)) or as the single expression of a lambda body ([§15.27.2](15.27.2.md)), because every other context in which an expression can appear requires the expression to denote something. An expression statement or lambda body that is a method invocation may also invoke a method that produces a result; in this case the value returned by the method is quietly discarded.

Evaluation of an expression can produce side effects, because expressions may contain embedded assignments, increment operators, decrement operators, method invocations, and, in `switch` expressions, arbitrary statements.

An expression occurs in either:

- The declaration of some (class or interface) type that is being declared: in a field initializer, in a static initializer, in an instance initializer, in a constructor declaration, in a method declaration, or in an annotation.
- An annotation on a package declaration or on a top level type declaration.
