java8
java8
array of arrays.
Syntax for declaring a two dimension array:
datatype arrayName[));
before the array
2d no Rule 1: At the time of array declaration we can specify the pair of ()[) either
name or after the array name.
yJVN int arr1[]0;
int[][]arr2;
int [)[Jarr3;
arra int[] (Jarr4;
int (larrS[:
int[] arr6[]:
specify size of the array.
Rule 2: At the time of array declaration we should not
Syntax for creating 2 dimensional array:
datatype arrayName[][) =new datatype[size1] [size2];
Or
datatype arrayName[][l;
arrayName = new datatype[size1](size2];
Example:
int arr[][ =new int[3][4];
Or
int arr[][):
arr = new int(3][4];
dimension of array is mandatory and the
Rule: In a multi dimension array specifying the first
dimensions then they must be specified
remaining are optional. If we are specifying the remaining
in the order from left to right.
arr
1000 20003000
1
0 1 2 1 2 3 1
30