With parameter method

Source: Internet
Author: User

A method with parameters

Syntax: 

The access modifier method returns a value type method name (parameter list) {

Method body

}

  For example:

public void Seachname (String name,int start,int end) {

Method body

}

 ※ Each parameter is separated by ","

Second, formal parameters and arguments

   formal parameter: parameters specified at method definition

   actual parameters:  parameters that are specified when the method is called

Iii. issues to be noted when invoking a parameter method

1. Parameter data types of formal parameters and arguments remain consistent

2. The order of formal parameters and arguments remains the same

3. The number of formal parameters and arguments remains the same

Iv. Array of objects

Example: creating an array of teacher objects

       Teacher [] teachers=new teacher[5];

With parameter 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.