The Java® Language Specification, Java SE 7 Edition, Fourth Edition
by James Gosling, Bill Joy, Guy Steele, Gilad Bracha, Alex Buckley
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access