public class Main {
public static void main(String[] args) {
List[] list = new ArrayList[3];
list[0] = new ArrayList<Integer>();
list[0].add("string");
ArrayList<Integer> arr = new ArrayList<>();
arr.add("string");
}
}
Frist question: I already state that the ArrayList should accept Interger. But it do not throw error when I try to assign a "string" into this ArrayList. I really don't know why this happen.
Seconde question: Why I can declare a list by this "List[] list = new ArrayList[3];"