ArrayList> num = new ArrayList>();这样是可以的,但是你还没有给他赋值就取值是不对的,你应该先给num赋值
回答2:
ArrayList> num = new ArrayList>(); int index = 3; ArrayList member1 = new ArrayList(); ArrayList member2= new ArrayList(); ArrayList member3 = new ArrayList(); ArrayList member4 = new ArrayList(); num.add(member1 ); num.add(member2); num.add(member3 ); num.add(member4 ); num.get(index).add(1);