Description of object-oriented && method

method

Definition:
can be understood as the name of a piece of code

format:

Modifier return value type method name (parameter type 1 parameter name 1,...) { method body; Return return value; }


Method specification:
modifier
Return value type: Reflected in whether this function should return a certain value.
Yes-it can be any Java type (basic type, reference type)
No-Java provides a special keyword void
method name: yes Identifier, as long as it meets the rules and specifications.

() The parentheses cannot be omitted. The content in parentheses:
No content: means that the realization of my function does not rely on any external input.
If there is content: it must appear in pairs. The specific timing needs to be separated by a comma between multiple pairs, and
the braces must not be less. It specifies what a "code fragment" is.
The method body is any Java code that we are familiar with.

Guess you like

Origin blog.csdn.net/weixin_47371330/article/details/107595773