-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTwoArrayTest1.java
More file actions
52 lines (44 loc) · 1.21 KB
/
Copy pathTwoArrayTest1.java
File metadata and controls
52 lines (44 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.company.array;
/**
* @author 苏东坡
* @company 公司
* @create 2021-07-29-11:24 下午
*/
public class TwoArrayTest1 {
public static void main(String[] args) {
//二维数组的遍历
int[][] arr = {{1, 2, 3}, {4, 6}, {7}};
/**
* 外层普通for循环+内层普通for循环
*/
// for (int i = 0; i < arr.length;i++){
// for (int j = 0; j < arr[i].length; j ++){
// System.out.print(arr[i][j]+"\t");
// }
// }
/**
* 外层普通for循环+内层增强for循环
*/
// for (int i = 0; i < arr.length; i++) {
// for (int num : arr[i]) {
// System.out.print(num + "\t");
// }
// }
/**
* 外层增强for循环+内层增强for循环
*/
// for (int[] a : arr){
// for (int num : a){
// System.out.print(num+"\t");
// }
// }
/**
* 外层增强for循环+内层普通for循环
*/
// for (int[] a : arr){
// for (int i = 0; i < a.length;i++){
// System.out.print(arr[i]+"\t");
// }
// }
}
}