File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What's the difference between return and return()

 
Parka Teoh
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic