public static void main(String args[])
{
int[] intarray = {1, 3, 6, 8, 2, 6};
String[] names = {"String1", "String2", "String3", "String4", "String5", "String6"};
printMe(intarray);
}
public static <T> void printMe(T[] i){
for(T x: i)
{
System.out.println(x);
}
}
이 코드를 컴파일하면이 오류가 발생하는 이유는 무엇입니까?int []를 T []가 걸리는 일반 메서드에 전달
The method printMe(T[]) is not applicable for the arguments (int[])
내가 printMe(names)
이면 작동합니다.
가능한 정수 [Java에서 int \ [\]를 Integer \ [\]로 변환하는 방법 "(http://stackoverflow.com/questions/880581/how-to-convert-int-to-integer- in-java) – finnw
관련 항목 : http://stackoverflow.com/questions/1467913/arrays-aslist-not-working-as-it-should – finnw