例子
int[][]arry = new int[][]{{1,2,8},{2,4,13},{6,79,5,6}};
for(int x[]:arry){
System.out.println("\n");
for(int a:x){
if(a == x[x.length-1]){
System.out.print(a);
}else{
System.out.print(a+",");
}
}
//System.out.println();
}
运行效果:
1,2,8
2,4,13
679,5,6