Java Notes------Methods

Source: Internet
Author: User

Method:
1) for encapsulating a specific logic function
2) be as independent as possible and do only one thing
3) can be called multiple times
4) Clear structure and easy maintenance
1. Definition of the method:
Modifier return value type method name (parameter list)

{
Method body
}


Attention:
1) The method can have the parameter and can be no parameter, the parameter is more flexible
2) The method can have a return value or it can have no return value:
No return value, return value type write void
Has a return value, the return value type writes the specific data type
2. Invocation of the method

No parameter no return value: Method name ();
Parameter no return value: Method Name (value, value);
No parameter has a return value: Data type variable = method name ();
There are parameter return values: Data type variable = Method name (value, value);

Java Notes------Methods

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.