-------<a href= "http://www.itheima.com" target= "blank" >android training </a> <a href= "/http/ Www.itheima.com "target=" blank ">java training </a>, look forward to communicating with you! ----------
definition: a piece of independent applet defined in a class that has a specific function. Also called methods.
Format:
Modifier returns a value type function name (parameter type form parameter 1, parameter type form parameter 2, ... )
{
Execute the statement;
return value;
}
Characteristics:
1. Define functions to encapsulate the function code to facilitate reuse of the function.
2. The function will be executed only if it is called.
3. The appearance of function improves the reusability of code.
4, for the case where the function does not have a specific return value, the return value type is denoted by the keyword void, then the return statement in the function can be omitted from the last line if not written.
Overload
Concept: In the same class, more than one function with the same name is allowed, as long as the number of argument lists or the parameter types are different.
Features: Regardless of the return value type, see only the parameter list.
Benefits: Easy to read and optimized for programming.
Dark Horse Programmer--function