In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "the definition format of functions in java". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
Functions: To improve code reusability, it can be defined as a separate function, which is embodied in java functions. Function is one of them.
Definition of functions in Java:
Modifier return value type function name (parameter type formal parameter 1, parameter type formal parameter 1,…){
Execution statements;
return return value;
}
When a function has no specific return value, the return value type is indicated by the void keyword.
If the return value type of the function is void, the return statement can be omitted, and the system will automatically add it for you.
Return: End the function. End function.
How to define a function?
A function is actually a function. Defining a function is to realize a function. It is done through two explicit methods:
1). Clarify the result of the operation of this function, in fact, it is to clarify the return value type of this function.
2) Whether there is unknown content involved in the operation in the process of implementing this function, in fact, it is to clarify the parameter list of this function (parameter type & number of parameters).
Functions:
1) Used to define functions.
2) It is used to encapsulate code to improve the reusability of code.
Note: Functions can only be called, not defined.
Main function:
1) Ensure the independent operation of this class.
2) Because it is the entry point of the program.
3) Because it is called by JVM.
What is the function definition name?
Answer: 1) In order to mark the function, it is convenient to call.
2) In order to clarify the function by name, in order to increase the readability of the code.
Overload definition is: in a class, if there are two or more functions of the same name, as long as the number of their parameters, or the type of parameters are different, it can be said that the function is overloaded.
How to distinguish overloading: When a function has the same name, just look at the parameter list. regardless of the type of return value.
"Java function definition format" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
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.