14.17. The return Statement

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

ReturnStatement:    return Expressionopt ;

A return statement is contained in the innermost constructor, method, or initializer 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.7).

A return statement with no Expression must be contained in a method that is declared, using the keyword void, not to return any value (§8.4), or in a constructor (§8.8), or a compile-time error occurs.

A return statement with no Expression attempts to transfer control to the invoker of the method or constructor that contains ...

Get The Java® Language Specification, Java SE 7 Edition, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.