View Single Post
Old 07-31-2012, 08:19 PM   PM User | #8
tomjas
New to the CF scene

 
Join Date: Jul 2012
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
tomjas is an unknown quantity at this point
Quote:
Originally Posted by greeninho View Post
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).
My question was: what's a "return val" statement for? Did you have a look at my last code in previous post? There is no return statement, but I still get a proper feedback from method - I obtained calculated value of "i" variable without returning it. I just invoked it.
tomjas is offline   Reply With Quote