A method is a procedure on an object which can be invoked. A method may have parameters to pass additional information. All methods have return types / values, a method may return void if no information is being handed back to the caller.
A method implements the behaviour of objects, they have a consistent structure of a header and a body.
- The header describes:
- The visibility to objects of other classes.
- Whether the method returns a result.
- The name of the method.
- Whether the method takes parameters.
- The body encloses the body’s statements.