• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

VarArgs

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Could you please let me know why I am not able to call these methods & how I can call these methods.
 
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a similar problem: var-args overloading compiler error: ambiguous and the problem went away when I upgraded to the latest Java version.
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tom Reilly wrote:I had a similar problem: var-args overloading compiler error: ambiguous and the problem went away when I upgraded to the latest Java version.



I think both are different issues. In this questions the ambiguity is due to- Either use the int version or to autobox to use the Integer version.
 
Ranch Hand
Posts: 160
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Integer... and int... both are considered as arrays and there is no way to compare this two arrays for compiler. so that when it finds any integer parameter passed into method at that compiler checks both version of method if the argument passed can satisfy the requirement and here in this case it finds that both methods are eligible to run so that compiler gets confused which method to call. Therefore it gives ambiguity error......

if there would be Long and Integer parameters in the methods then compiler can easily find out that which method to call because compiler can differentiate them .........
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic