• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Boxing

 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Source Java Beat


class Boxing6 {
public static void checkThis(Double d1, Double ... d2) {
System.out.println("Double and Var-Args");
}
public static void checkThis(Double d1, Double d2, Double ... d3) {
System.out.println("Double , Double and Var-args");
}
public static void checkThis(double d1, Double d2, Double ... d3) {
System.out.println("double , Double and Var-args");
}
public static void main(String [] args) {
checkThis(15.5d, 26.6d, 37.7d); // line 1
}
}
output
compiler error.

where as i thought it sould be double,Double and Var-args.

please help me out with this
 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

For the method call, the compiler would find a match in all the three forms of checkThis() and this ambiguity causes the compiler error.

Thanks
reply
    Bookmark Topic Watch Topic
  • New Topic