In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is to share with you about what the method in Java means. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Statement blocks (sometimes called compound statements) are any number of simple Java statements expanded with curly braces. Block determines the scope of the local variable. The program code in the block, as a whole, is executed together. Blocks can be nested within another block, but variables with the same name cannot be declared within two nested blocks. Statement blocks can use external variables, while external variables cannot be used outside, because the scope of variables defined in statement blocks is limited to statement blocks.
Methods in Java
A method is a code snippet used to perform a specific function, similar to a function in other languages.
Method is used to define the behavioral characteristics and functional implementation of the class or an instance of the class. A method is an abstraction of the behavioral characteristics of classes and objects. The method is very similar to a procedure-oriented function. In the process-oriented process, the function is the most basic unit, and the whole program is composed of function calls. In object-oriented, the basic unit of the whole program is the class, and the method is subordinate to the class and object.
Method is called:
Object name. Method name (argument list)
A detailed description of the method
Formal parameter: used to receive incoming data when the method is declared.
Argument: the data actually passed to the method when the method is called.
Return value: the method returns data to the environment in which it is called after execution.
Return value type: the pre-agreed data type of the return value. If there is no return value, it must be specified as void.
Overloading of methods in Java
Method overloading means that multiple methods with the same name but different parameters can be defined in a class. When called, the corresponding method is automatically matched according to different parameters.
Minefield
The method of overloading is actually a completely different method, but with the same name!
The conditions that make up the method overload:
1. Different meanings: the type, number and order of formal parameters are different.
two。 Only different return values do not constitute the overload of the method.
Thank you for reading! This is the end of this article on "what is the meaning of the method in Java". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.