The return Statement
Return to exit form the current method and jump back to the statement within the calling method that follows the original method call.
There are two forms of return: one that returns a value and one that doesn’t. To return a value, simply put the value (or expression that calculates the value after the return keyword:
return ++count;
The value returned by return must match the type of method’s declared return value. When a method is declared void use the form of return that doesn’t return a value return;
No comments:
Post a Comment