aspose file tools*
The moose likes Beginning Java and the fly likes What's the difference between return and return() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What Watch "What New topic
Author

What's the difference between return and return()

Parka Teoh
Ranch Hand

Joined: Aug 28, 2004
Posts: 40
Let's say I have a getter method.

What is the difference between a return and a return()?



[ October 19, 2004: Message edited by: Parka Teoh ]

Do you have a parka?<br /> <br /><a href="http://sg.geocities.com/inschooool" target="_blank" rel="nofollow">Visit my homepage</a> | <a href="http://parka.deviantart.com/" target="_blank" rel="nofollow">Parka Deviantart gallery</a>
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Nothing.

return returns the result of an expression. An expression can be enclosed in a pair of redundant parentheses.

So you could write if you want.


But if your method's return type is void you cannot write return (); - it must be just return;
[ October 19, 2004: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
 
subject: What's the difference between return and return()