Java Basics (six) method

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_44779847/article/details/102732118

1. Method:
1) Package-specific service logic function section
2) as independent as possible, a method only do one thing
3) method can be called multiple times repeatedly
4) reduces code duplication, conducive to maintenance of the code is conducive team collaboration
2. definition of the method:
modifier return type method name (parameter list) {
method body
}
calling method 3:
1) None return value: methods (with reference parameter passing);
2) returns a value ;: data type variable name = method (with reference parameter passing)
: 4.return
. 1) return value; //1.1 execution 1.2) of the end of the process) returns the result to the caller
end of execution of the method //2.1); 2) return (no return value of the method)

Guess you like

Origin blog.csdn.net/qq_44779847/article/details/102732118