![]() |
Java return statement problem.
Hello there :)
I have a question about the return statement... I'm not getting anything when I run my code. I should get answers like Winter, Fall, Spring, Summer but my return is not working? Thanks for the help. :) Here is my code: Code:
|
You aren't seeing anything because you aren't doing anything with the returned value. The return statement just returns the value of the defined type to the caller of that method. In any language such as Java/C/C++ that supports a "return" statement, in order to use the returned value you would need to either "assign" that return value to a variable and then use it or simply make that method call where you need the value.
i.e. variable = methodCall(); print(variable); or print(methodCall()); |
| All times are GMT +1. The time now is 07:31 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.