First, to get started
1 Overview
Methods: a feature extracted, the code is defined in a single playing brackets, form a single feature. When you need to use this feature. I went to call this method, so that is realized the reusability of code, but also solve the redundant code.
2, the definition of the method
- Definition format
修饰符 返回值类型 方法名(参数列表){
代码。。。
return;
}
- Definition Format explanation:
- Modifiers: The current wording is fixed
public static
. - Return Value Type: Fixed current wording
void
. - Method name: identifier meet specifications, used to call the method.
- Modifiers: The current wording is fixed
- The method of naming
- The method of naming variables, the use of a small hump.
- Procedure: Use any of the statements contained in braces.
- Call the format method
方法名();