• Post Reply Bookmark Topic Watch Topic
  • New Topic

overloading based on returntype  RSS feed

 
Chandra shekar M
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In java why we wont have overloading based on return type.

Thanks
Chandra
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now when I call getValue(), which one should be called?
 
Chandra shekar M
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My thought was

String s=getValue(); //call String
int i=getValue();//call Int

but what will happen now
getValue(); //not sure how to handle this

May be this was the reason why we wont have overloading based on returntype?

Thanks
Chandra
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's my guess.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!