12/07/03 06:47:02.43
Eclipse で以下のコードがコンパイルできないのですが、何が間違っているのでしょうか?
import java.util.ArrayList;
public class Hoge {
public static void main(String[] args) {
ArrayList<Integer> arrayList = new ArrayList<Integer>();
arrayList.add(42);
arrayList.add(123456);
int[] as = (int[])arrayList.toArray(new int[0]); // ここでビルドエラー
System.out.println(as[0]);
System.out.println(as[1]);
}
}