大数据学习20190329
数组
1 public class ArrayDemo03 {
2
3 public static void main(String[] args) {
4
5 int[] arr1 = new int[]{1,2,3,5};
6 for (int i = 0; i < arr1.length; i++) {
7 System.out.print(arr1[i]+"\t");
8
9 }
10 System.out.println();
11 int[][] arr2 = new int[3][];
12 arr2[0] = new int[]{2,4,5};
13 arr2[1] = new int[]{1,3};
14 arr2[2] = new int[]{2,14,5,56};
15 for (int i = 0; i < arr2.length; i++) {
16 for (int j = 0; j < arr2[i].length; j++) {
17 System.out.print(arr2[i][j]+"\t");
18 }
19 System.out.println();
20 }
21 int[][] arr3 = {{1,2},{34,56,78},{23,56,789,90}};
22 for (int i = 0; i < arr3.length; i++) {
23 for (int j = 0; j < arr3[i].length; j++) {
24 System.out.print(arr3[i][j]+"\t");
25 }
26 System.out.println();
27 }
28 }
29 }