Method:
1) for encapsulating a specific logic function
2) be as independent as possible and do only one thing
3) can be called multiple times
4) Clear structure and easy maintenance
1. Definition of the method:
Modifier return value type method name (parameter list)
{
Method body
}
Attention:
1) The method can have the parameter and can be no parameter, the parameter is more flexible
2) The method can have a return value or it can have no return value:
No return value, return value type write void
Has a return value, the return value type writes the specific data type
2. Invocation of the method
No parameter no return value: Method name ();
Parameter no return value: Method Name (value, value);
No parameter has a return value: Data type variable = method name ();
There are parameter return values: Data type variable = Method name (value, value);
Java Notes------Methods