• Post Reply Bookmark Topic Watch Topic
  • New Topic

Overloading with vargs  RSS feed

 
Vanguard Hawk
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am working on Java 1.5 .Yesterday i tried below example.



The above code is giving the below compilation error

The method display(Integer[]) is ambiguous for the type A WideningWithVargs .java CoreJavaSample/src/com/chap01 line 38 Java Problem

on the line

a.display(12,13);


I am not actually able to understand the reason for the error.

Can anybody tell me the reason for the above error?

 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's varargs not vargs.

The compiler cannot distinguish whether you want the Integer... version (via boxing) or the long... version (via a widening primitive conversion).
 
Vijay Tidake
Ranch Hand
Posts: 148
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please check link

Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!