aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Widening, boxing with var-args and overloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Widening, boxing with var-args and overloading" Watch "Widening, boxing with var-args and overloading" New topic
Author

Widening, boxing with var-args and overloading

Andry Dub
Ranch Hand

Joined: Nov 06, 2007
Posts: 43
Hi! I wonder, why this code has a compiler error (ambiguous method call). Doesn't widening beat boxing?

public class Pennard {
public static void main(String argv[]) {
Pennard p=new Pennard();
int d=7;
p.doit(d,d); <-compile error here
}
public void doit(long...x){
System.out.println("long...x");
}
public void doit(Integer...x){
System.out.println("Integer...x");
}
}


Java is my love
Joshua Fix
Ranch Hand

Joined: Sep 18, 2007
Posts: 57
The same topic was just covered here:

http://www.coderanch.com/t/266522/java-programmer-SCJP/certification/Overloaded-varargs-param


SCJP 5.0
Joshua Fix
Ranch Hand

Joined: Sep 18, 2007
Posts: 57
The same topic was just covered here:

http://www.coderanch.com/t/266522/java-programmer-SCJP/certification/Overloaded-varargs-param
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Widening, boxing with var-args and overloading
 
Similar Threads
widening,boxing and var args??
Overloading with varargs
Widening,Boxing and Var-Args Combined
var-args and overloading
Widening