0% found this document useful (0 votes)
2 views

java8

Java script 8

Uploaded by

siva
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

java8

Java script 8

Uploaded by

siva
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Multi dimensional arrays: The multidimension arrays in java will be represented in the form of

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

1000 2000 3000


0 0 0

0 1 2 1 2 3 1

30

You might also like