다음 코드는 자바에서 잘 컴파일 작업하는 동안 유사한 호출 메커니즘은 자바에 의해 관리되지 않는 이유방법 전화 주문
public static void main(String[] args) {
int i =5;
call(i);
}
static void call(int... i){
System.out.println("int...");
}
static void call(long... i){
System.out.println("long...");
}
static void call(Integer... i){
System.out.println("Integer...");
}
static void call(Object... i){
System.out.println("Object...");
}
을 var-args? 두 번째 예제에서도 호출은 메서드로 이동해야합니다. static void call(int... i)
'정수'및 '객체'버전이 없으면 작동합니까? 그렇다면 오토 박싱 때문입니다. – NilsH
가능한 복사 http://stackoverflow.com/questions/2521293/bug-with-varargs-and-overloading –
올바른 @ c.P.u1. 그러나, 그것은 최신 jdk 7 버전으로 수정해야합니다, 그래서 나는 autoboxing 때문에이 특정 오류가 있다고 가정합니다. – NilsH