标签:
1 //二维数组,初始化,写出各元素 2 3 int[][] n={{12,0},{3,5,11},{2,5,7,8}}; 4 int sum1 = 0; 5 System.out.println("输出一个二维数组:"); 6 //二维数组的遍历输出,foreach写法,依然有两个for 7 for(int[] m:n) 8 { 9 for(int g:m) 10 { 11 System.out.print(g+" "); 12 sum1 += g; 13 } 14 System.out.println(); 15 } 16 System.out.println("所有元素和是:"+sum1);
标签:
原文地址:http://www.cnblogs.com/hellodp/p/5119949.html