"Song Hongkang Learning Diary 7" Object-oriented Programming "2" class and method

Source: Internet
Author: User

11 Anonymous class New Circle ();(created can only be used once no longer called)

Two variable number parameter forms (component overloads)

public int getsum () {}

public int Getsum (int i,int j) {}

public int getsum (int ... args) {}=public int getsum (int[] aargs)

"Note" If there is a variable number of formal parameters in the method, it is declared in the post public void SayHello (int i,string...str) (there is a maximum of one variable number of parameters in a method)

Parameter passing of three methods

1 delivery mechanism: value passing (a copy of the actual parameter is passed in the method, and the parameter itself is not affected)

The 2 parameter is the basic data type, and the value of the argument is passed to the variable of the basic data type of the formal parameter;

A 3 parameter is a reference data type that passes the value of the argument's reference type variable (the first address of the entity value of the heap space object) to the reference variable of the formal parameter.

"Song Hongkang Learning Diary 7" Object-oriented Programming "2" class and 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.