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