wood burning stoves 2.0*
The moose likes Java in General and the fly likes overloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "overloading" Watch "overloading" New topic
Author

overloading

S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 244
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: 1776
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: 4343
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: overloading
 
Similar Threads
Method Overloading
compile error in constructor
question on overloaded methods
is there any way pass arguments to class method without overloading ?
Overriding & Overloading