- public class Test {
- /**
- * @param args
- */
- public static void main(String[] args) {
- Collection c =new ArrayList();
- int[] arr = {2,3,4};
- int[] arr1= {6,7,8};
- c.add(arr);
- c.add(arr1);
- for(Object o:c){
- int[] iteratorObj =( int[])o;
- System.out.println("当前数组值:"+iteratorObj[0]+","+iteratorObj[1]+","+iteratorObj[2]);
- }
-
- }
复制代码 结果:
当前数组值:2,3,4
当前数组值:6,7,8
结论:都可以添加的 |