Method - is a collection of statements that are grouped together to perform an operation.
Syntax: modifier returnType nameOfMethod (Parameter List)
{ //body
}
modifier - defines the access type of the method
returnType - may return a value. A method in Java returns only 1 value.
nameOfMethod - name of a method
Parameter List - contains the type, order, and number of parameters
body - any valid Java statement
signature of a method - is composed of the method name and parameter list
Types of methods
1. Standard library methods - are built-in methods that are ready to use
2. User-defined methods - are created in order to perform user requirements.
Walang komento:
Mag-post ng isang Komento