aspose file tools*
The moose likes Java in General and the fly likes Overloading with Varargs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Overloading with Varargs" Watch "Overloading with Varargs" New topic
Author

Overloading with Varargs

sr shashidhar
Greenhorn

Joined: Jan 17, 2013
Posts: 27
Hi frndz



While compiling getting exception as

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method m1(int[]) is ambiguous for the type A

my doubt is according to overloading concept Output must be "BYTE", but why Compilation error..

Thanks in advance
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19723
    
  20

Which compiler are you using? If I compile that code with Java 7u11 I get no errors at all, and it also runs just fine, printing BYTE.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
sr shashidhar
Greenhorn

Joined: Jan 17, 2013
Posts: 27

J2SE 5.0(1.5)
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8016
    
  22

sr shashidhar wrote:J2SE 5.0(1.5)

Erm...you do understand that J2SE 5.0 entered its end-of-life on April 8, 2008 and hasn't been supported by Sun/Oracle since November 3, 2009?

That's quite apart from any questions about why you're overloading methods with ellipses...

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Overloading with Varargs