• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

void method returning nothing

 
Deepika Saxena
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I read that void methods should not return any thing. But when i tried the following code, it is not giving any error.

could any body tells how the above code is compiling and running fine, though we are mentioned return statement.

Thanks.
--Deepika
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34965
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepika,
"return" returns whatever is after the word return. Meaning "return 0;" returns an integer. "return;" returns what is after the word - nothing!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic