| Author |
overloading
|
S Majumder
Ranch Hand
Joined: Jun 03, 2009
Posts: 241
|
|
Hi All,
I have one confusion about the overloading ...
Why this code is giving duplicate methods exception ?
Thanks,
Satya
|
 |
Girish K Gupta
Greenhorn
Joined: Mar 14, 2007
Posts: 19
|
|
|
Because for overloading the method arguments MUST be different.
|
Girish K Gupta
SCJP 1.5 - 87%, SCWCD 1.5 - 92%
India
|
 |
John Jai
Bartender
Joined: May 31, 2011
Posts: 1778
|
|
|
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
Joined: Apr 06, 2010
Posts: 3795
|
|
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.
|
 |
 |
|
|
subject: overloading
|
|
|