aspose file tools
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 The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "overloading" Watch "overloading" New topic


S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 344
Hi All,
I have one confusion about the overloading ...

Why this code is giving duplicate methods exception ?

Girish K Gupta

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%
John Jai

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

Joined: Apr 06, 2010
Posts: 4518

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.
Have you tried LearnNowOnline?
subject: overloading