Title: Key Concept - Method
Course: CPS 189: Java Certification - Review, Practice & Prepare (Development) > Section: (OLDstyle) Learning Modules

● A method is a block of named code that is called as needed.

- A method executes until one of the following occurs:
  - It completes all the statements in its block.
  - It reaches a return statement.
  - It throws an exception.

● Upon completion, a method may or may not return a value.

● A method declared void does not return a value.

● A method declared with a data type must contain at least one return statement with a return value that matches that data type.

The data type may be:

- Primitive type – byte, short, int, long, float, double, boolean, or char.
- Reference type – class or interface.

For more information about a method:

- Click this link to view Oracles's documentation: Returning a Value from a Method.
- Level 1 Study Materials: Unit 5