If the method does not contain a parameter, but has a return value, we call it a method with no parameter return value.
For example: The following code, which defines a method named Calsum, has no arguments, but the return value is of type int, performs an operation that calculates the sum of two numbers and returns the result
In the Calsum () method, the return value type is type int, so you must return an integer value using return in the method body.
When calling a method with a return value, it is important to note that because the method executes returns a result, the return value is generally received and processed when the return value method is called. Such as:
The result of the operation is: two sum of: 17
"Small traps" that cannot be overlooked:
1. If the return type of the method is void, the return value cannot be used in the method!
2. The return value of a method can have at most one and cannot return multiple values
3, the type of the method return value must be compatible, for example, if the return value type is int, you cannot return a String value
Use of the non-parametric return value method in Java