Java-Preliminary Understanding-fourth-function-demo exercises

Source: Internet
Author: User

Why do you have to rewrite the function practice? Is that they are unfamiliar with defining functional function formats, and feel ready to forget.

Here again to do a writing, and detailed analysis of the meaning behind each step.

Class Functiondemo

{

public static void Main (string[] args)//the function function defined here is the most common three types only, there are inputs, there are return values.

{

int C=add (3, 4); This format of Add (3, 4) is a symbolic symbol that symbolizes a function, and the add represents the name of the function,

System.out.println ("C"); Add is followed by () to include all the numbers that are involved in the operation. Why should there be C=add (3, 4)?

}//Add (3, 4) represents the output value when the input data is functional, this value is indeterminate, and all the variables to be loaded.

There are too many points of attention to add when you formally define a functional function.

{//define a functional function, which is equivalent to writing a code block of one name. In the definition process, pay attention to the emphasis class//type, whether it is the type of the return value or the type of input data, must be marked.

return a+b; Within the code range, descriptive is the specific function, and the use of the special meaning of the keyword, the result is returned by the statement. Do not write an assignment statement

}//Because, this is not an assignment at all, but a return value.

}

Understanding: As far as the definition function function is concerned, there are three cases of function function: input, return value, input, no return value, no input, no return value. The value here may really refer to a value. The most common is that there is input and there is a return value. This kind of situation is functional and we can understand it best.

Java-Preliminary Understanding-fourth-function-demo exercises

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.