---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 9 Edition"
java_version: 9
chapter: "Chapter 14. Blocks and Statements"
section: "14.17"
heading: "14.17. The return Statement"
parent: "Chapter 14. Blocks and Statements"
source: https://docs.oracle.com/javase/specs/jls/se9/html/jls-14.html#jls-14.17
id: "14.17"
url: https://jvm.obfuscated.software/jls/se9/14.17.html
raw: https://jvm.obfuscated.software/jls/se9/14.17.md
---

# 14.17. The `return` Statement

A `return` statement returns control to the invoker of a method ([§8.4](8.4.md), [§15.12](15.12.md)) or constructor ([§8.8](8.8.md), [§15.9](15.9.md)).

```
ReturnStatement:
  return [Expression] ;
```

A `return` statement is *contained* in the innermost constructor, method, initializer, or lambda expression whose body encloses the `return` statement.

It is a compile-time error if a `return` statement is contained in an instance initializer or a static initializer ([§8.6](8.6.md), [§8.7](8.7.md)).

A `return` statement with no *Expression* must be contained in one of the following, or a compile-time error occurs:

- A method that is declared, using the keyword `void`, not to return a value ([§8.4.5](8.4.5.md))
- A constructor ([§8.8.7](8.8.7.md))
- A lambda expression ([§15.27](15.27.md))

A `return` statement with no *Expression* attempts to transfer control to the invoker of the method, constructor, or lambda body that contains it. To be precise, a `return` statement with no *Expression* always completes abruptly, the reason being a return with no value.

A `return` statement with an *Expression* must be contained in one of the following, or a compile-time error occurs:

- A method that is declared to return a value
- A lambda expression

The *Expression* must denote a variable or a value, or a compile-time error occurs.

When a `return` statement with an *Expression* appears in a method declaration, the *Expression* must be assignable ([§5.2](5.2.md)) to the declared return type of the method, or a compile-time error occurs.

A `return` statement with an *Expression* attempts to transfer control to the invoker of the method or lambda body that contains it; the value of the *Expression* becomes the value of the method invocation. More precisely, execution of such a `return` statement first evaluates the *Expression*. If the evaluation of the *Expression* completes abruptly for some reason, then the `return` statement completes abruptly for that reason. If evaluation of the *Expression* completes normally, producing a value `V`, then the `return` statement completes abruptly, the reason being a return with value `V`.

If the expression is of type `float` and is not FP-strict ([§15.4](15.4.md)), then the value may be an element of either the float value set or the float-extended-exponent value set ([§4.2.3](4.2.3.md)). If the expression is of type `double` and is not FP-strict, then the value may be an element of either the double value set or the double-extended-exponent value set.

It can be seen, then, that a `return` statement always completes abruptly.

The preceding descriptions say "attempts to transfer control" rather than just "transfers control" because if there are any `try` statements ([§14.20](14.20.md)) within the method or constructor whose `try` blocks or `catch` clauses contain the `return` statement, then any `finally` clauses of those `try` statements will be executed, in order, innermost to outermost, before control is transferred to the invoker of the method or constructor. Abrupt completion of a `finally` clause can disrupt the transfer of control initiated by a `return` statement.
