public class PrintArray {
public static void main(String args[]) {
// 用二位数组
int arr[][] = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};
System.out.println("行 列 数");
for(int i = 0; i < 4; i++) {
for(int j = 0; j < 4; j++) {
System.out.println(i + " " + j + " " + arr[i][j]);
}
}
}
}
运行结果:
------------------
行 列 数
0 0 1
0 1 2
0 2 3
0 3 4
1 0 5
1 1 6
1 2 7
1 3 8
2 0 9
2 1 10
2 2 11
2 3 12
3 0 13
3 1 14
3 2 15
3 3 16
温馨提示:答案为网友推荐,仅供参考