Java Basics-Method

Source: Internet
Author: User

Statement: The material used in this column is written by the VIP students of the Kay Academy, who has the right to be anonymous and has the final right to interpret the article; The Edith Academy is designed to promote students to learn from each other on the basis of public notes.

I. Method of parameter transfer

1. Normal parameter transfer: Request a data type, call a method to pass the address, modify the print value,

2. Set parameter pass (infinite parameter): Infinite parameter is the avatar of the array, can request a multidimensional array as an infinite parameter.
3. Reference parameter passing: request an array, reference a method to pass a value,

4. Method Overload: The method name, the method parameter type and number of different, in the case of duplicate method name can be used, change the parameters for a bit, do not change the meaning, but different types of parameters, different types of printing is not the same, the same method name can run different code, but the parameters must not be the same, Otherwise, it doesn't make sense.

Two. return value

1. The return value is a number returned when the condition is satisfied, it can only be a type, such as: array type, basic type, other types;
2. Once the method requests the return value, it must have a return;
There are two cases of 3.return:
① the results back out;
② End method.
Note: You cannot write any more code after return.
Three. Recursion 1. Recursion is the method call method, is a layer of nested one layer,

2. Use recursion to be aware that the number of nesting is limited, if the memory is more than the scope of use, support will be error, the number of nesting is based on the computer configuration decision.

Java Basics-Method

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.