问题描述
原始数据:A1A2A3A4B1B2B3B4C1C2C3C4转换后的数据:A1B1C1A2B2C2A3B3C3A4B4C4publicstaticvoidmain(String[]args){Listlist=newArrayList();Object[]rows1=newObject[]{"A1","A2","A3","A4"};Object[]rows2=newObject[]{"B1","B2","B3","B4"};Object[]rows3=newObject[]{"C1","C2","C3","C4"};list.add(rows1);list.add(rows2);list.add(rows3);for(inti=0;i<list.size();i++){Object[]objs=(Object[])list.get(i);for(intj=0;j<objs.length;j++){System.out.print(objs[j]);}System.out.println();}在此添加代码:}
解决方案
解决方案二:
看看是不是你想要的Object[]rows1=(Object[])list.get(0);intlen=rows1.length;for(inti=0;i<len;i++){for(intj=0;j<list.size;j++){Object[]objs=(Object[])list.get(j);System.out.print(objs[i]);}}
解决方案三:
list.size改成list.size(),手误写错了
时间: 2024-12-05 17:04:38