• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

overloading

 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have one confusion about the overloading ...


Why this code is giving duplicate methods exception ?

Thanks,
Satya
 
Girish K Gupta
Greenhorn
Posts: 19
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because for overloading the method arguments MUST be different.
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because overloading methods need to be different in their parameter list. Different return types alone doesn't make a method different from one another. Read more here
 
Matthew Brown
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that you don't have to do anything with return values - it's allowable to ignore them. So if you went
Which one gets called? The compiler can't tell.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic