|
If I understand your question 'why use return in some methods?'.
You only use 'return' when your method is declared with any of java primitive types.
Remember the format for declaring method:
accessModifier type methodName(parameters)
{
statements;
}
'void' is a type that doesnt return anything,so it doesnt use return.
E.g:
Consider me(int) sending you(statements) to the market, when you return, you must give me a feedback(return statement).
|