View Single Post
Old 07-31-2012, 08:12 PM   PM User | #7
greeninho
New Coder

 
Join Date: Dec 2011
Location: abuja
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
greeninho is an unknown quantity at this point
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).
greeninho is offline   Reply With Quote