-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDemo2.java
More file actions
42 lines (38 loc) · 940 Bytes
/
Demo2.java
File metadata and controls
42 lines (38 loc) · 940 Bytes
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
public class Demo2 {
public static void main(String[] args) {
//int array[] = {10,20,30,40,50,60,70};
//int []array = {10,20,30,40,50,60,70};
//int []array= new int[]{10,20,30,40};
int []array = new int[5];
array[0]=100;
array[1]=200;
//int [][]arr = new int[3][4];
//int [][]arr = {{10,20},{30,40},{50,60}};
//int [][] arr = new int[3][4];
//int arr[][] = new int[3][4];
int [] arr[] = new int[3][];
arr[0] = new int[4];
arr[1] = new int[10];
arr[2] = new int[20];
//System.out.println(arr.length);
for(int i = 0; i<arr.length; i++){
for(int j = 0 ; j<arr[i].length; j++){
System.out.println(arr[i][j]);
}
}
for(int d[]:arr){
for(int e : d){
System.out.print("Inner Loop "+e);
}
System.out.println();
}
/*for(int i = 0; i<array.length ; i++){
System.out.println(array[i]);
}*/
// Enhance for Loop
// 1.5
for(int x : array){
System.out.println(x);
}
}
}