import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
public class arraysAsList {
public static void main(String[] args) {
String [] arrayA = {"Box","Sun","Clock","Phone"};
Integer [] arrayB = {21,27,24,7};
List listStructureA = new ArrayList();
List listStructureB = new ArrayList();
listStructureA = Arrays.asList(arrayA);
listStructureB = Arrays.asList(arrayB);
System.out.println("My first list : " + listStructureA);
System.out.println("Sun = " + listStructureA.get(1));
System.out.println("My second list : " + listStructureB);
System.out.println("24 = " + listStructureB.get(2));
}
}
int는 기본 유형이고 Integer는 클래스라는 것을 알고 있습니다. 하지만이 스크립트에서 Integer 대신 int를 사용하려고하면 'index out of bounds exception'오류가 발생합니다. int를 사용하여 배열을 작성하기 전에 int 배열과 Integer 배열의 차이점은 무엇입니까? 미리 감사드립니다.이 스크립트에서 int와 Integer의 차이점은 무엇입니까?