Skip to content

Commit 23b0615

Browse files
committed
added arrays\Multi_Dimensional_Arrays.java
1 parent 7891d52 commit 23b0615

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

arrays/Multi_Dimensional_Arrays.java

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package arrays;
2+
3+
public class Multi_Dimensional_Arrays {
4+
5+
public static void main(String[] args) {
6+
7+
int firstarray[][]={{8,9,10,11},{12,13,14,15}};
8+
int secondarray[][]={{30,31,32,33}, {43}, {4,5,6}};
9+
10+
System.out.println(firstarray[0][2]);
11+
System.out.println(secondarray[2][1]);
12+
// an array can be from [0] to [9] but must start from [0]
13+
14+
15+
16+
/*
17+
* imagine that an array is a table
18+
* the first [] is like the row
19+
* the second [] is like the column
20+
* everything in an array goes in the outer brackets {}
21+
* each inner pair of brackets is separated with a comma {{},{}}
22+
* each inner pair of brackets is a row, the first []
23+
* and each element inside the inner brackets also separated with a comma, are
24+
* the columns
25+
*
26+
* for example:
27+
* {{a,b,c},{d,e,f}}
28+
* to get "b"
29+
* array [0][1]
30+
* because it's the zeroth row and first column
31+
*
32+
*/
33+
34+
35+
36+
}
37+
38+
}

0 commit comments

Comments
 (0)