标签:ring main 二维 pack ack static for i++ str
一. 二维数组遍历
package test_1;
public class test_7 {
public static void main(String[] args) {
int[][] arr = {{1,2,3},{5,6},{12,13,14}};
for(int i=0; i< arr.length ; i++) {
for(int j=0; j < arr[i].length ; j++){
System.out.print(arr[i][j] +" ");
}
System.out.println("");
}
}
}
二. 二维数组求和
package test_1;
public class test_8 {
public static void main(String[] args) {
int[][] arr = {{33,44,55},{77,55,33},{33,55,77},{99,88,77}};
int sum =0;
for(int i=0; i< arr.length ; i++) {
for(int j=0; j < arr[i].length ; j++){
sum =sum +arr[i][j];
}
}System.out.println(sum);
}
}
标签:ring main 二维 pack ack static for i++ str
原文地址:https://www.cnblogs.com/cloudLi/p/12864702.html