• Post Reply Bookmark Topic Watch Topic
  • New Topic

void and the Return Type  RSS feed

 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


In the above code main return type is void but still i can return , how is that possible ? What is happening in Compile Time and in Runtime ??
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every method must eventually return. And you are returning nothing. What is the type of nothing?
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Every method must eventually return. And you are returning nothing. What is the type of nothing?


Ooh! A Java Zen koan

John.
 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Every method must eventually return.

I didn't know that for 'void' return type.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun Giridharan wrote:I didn't know that for 'void' return type.
Well clearly you don't stay in void() methods forever
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun Giridharan wrote:I didn't know that for 'void' return type.

I'm not sure I'd categorise void as a type (for example, you can't pass a void to a method).

It is in some languages though.

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!