Dark Horse Programmer--function

Source: Internet
Author: User

-------<a href= "http://www.itheima.com" target= "blank" >android training </a> <a href= "/http/ Www.itheima.com "target=" blank ">java training </a>, look forward to communicating with you! ----------

definition: a piece of independent applet defined in a class that has a specific function. Also called methods.

Format:

Modifier returns a value type function name (parameter type form parameter 1, parameter type form parameter 2, ... )

{

Execute the statement;

return value;

}

Characteristics:

  1. Define functions to encapsulate the function code to facilitate reuse of the function.

2. The function will be executed only if it is called.

3. The appearance of function improves the reusability of code.

4, for the case where the function does not have a specific return value, the return value type is denoted by the keyword void, then the return statement in the function can be omitted from the last line if not written.

Overload

Concept: In the same class, more than one function with the same name is allowed, as long as the number of argument lists or the parameter types are different.

Features: Regardless of the return value type, see only the parameter list.

Benefits: Easy to read and optimized for programming.

Dark Horse Programmer--function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.