• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Overloading with Varargs

 
sr shashidhar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sr shashidhar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

J2SE 5.0(1.5)
 
Winston Gutkowski
Bartender
Pie
Posts: 10509
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic