1 |
Subprograms in Java are called methods. The definition format is
|
2 |
-
Modifiers Returntype Methodname ( Parameterlist )
-
{
-
declarations and statements
-
}
|
3 |
The parameter list contains the types and names of all the parameters.
|
4 |
The declarations and statements are called the body of the method. Parameter names and variables declared in the body are local to it.
|
5 |
Control returns from the methods either when the body is finished execution or a return statement is encountered. Return statements may also return a result.
|