a function's return type is specified in its method declaration.
a function's return type is specified in its method declaration.
where is a function's return type specified?
in its method declaration
section::::returning a value from a method.









































a method returns to the code that invoked it when it completes all the statements in the method, reaches a return statement, or









































throws an exception, whichever occurs first.









































you declare a method's return type in its method declaration. within the body of the method, you use the return statement to return the value.
return type
return type









































in computer programming, the return type (or result type) defines and constrains the data type of the value returned from a subroutine or method. in many programming languages (especially statically-typed programming languages such as c, c++, java) the return type must be explicitly specified when declaring a function.









































in the java example:









































the return type is "int". the program can therefore rely on the method returning a value of type "int". various mechanisms are used for the case where a subroutine does not return any value, e.g., a return type of "void" is used in some programming languages:
return type