杨洋 发表于 2012-8-3 19:10 ![]()
class ArrayTest
{
public static void main(String[] args)
class ArrayTest
{
public static void main(String[] args)
{
int[][] arr=new int[][]{{1,2,3},{4,5,6},{7,8,9,12}};
for (int x=0;x<arr.length ;x++ )//这里为x<arr.length,控制对大集合中小集合的遍历
{
for (int y=0;y<arr[x].length ;y++ )//这里改回去,y<arr[x].length 内存循环控制小集合中元素的遍历。
{
System.out.print(arr[x][y]);
}
System.out.println();
}
}
}
|