Which of the following Array declarations are valid?
int[] a,b; => a = 1D, b = 1D
int[] a[],b; => a = 2D, b = 1D
int[] []a,b; => a = 2D, b = 2D
int[] a[],b[]; => a = 2D, b = 2D
int[] []a,b[]; => a = 2D, b = 3D
int[] []a,[]b; =>CE
Note:- If we want to specify the dimension before the variable. This facility
is applicable only for the first variable in declaration. If we are trying
to apply for the next variable then we will get Compilation error.
Ex:- int[] []a,[]b,[]c; =>CE
int[] a[],b; => a = 2D, b = 1D
int[] []a,b; => a = 2D, b = 2D
int[] a[],b[]; => a = 2D, b = 2D
int[] []a,b[]; => a = 2D, b = 3D
int[] []a,[]b; =>CE
Note:- If we want to specify the dimension before the variable. This facility
is applicable only for the first variable in declaration. If we are trying
to apply for the next variable then we will get Compilation error.
Ex:- int[] []a,[]b,[]c; =>CE
0 comments: