Page 1 of 1

Array problem

Posted: Sun Jul 12, 2015 10:07 pm
by vanik34
can you help me to understand what is happening here
it's compiles ok

String ejgStr[] = new String[][]{{null},new String[]{"a","b","c"},{new
String()}}[3] ;
:(

Re: Array problem

Posted: Sun Jul 12, 2015 10:13 pm
by vanik34
Never mind it's create a two dimensional array and then return the [x] position
here is a more readable example
int[] eArr3 = new int[][]{{57},{1},{2},{3}}[0];

System.out.println(eArr3[0]);

Re: Array problem

Posted: Mon Jul 13, 2015 12:47 am
by admin
The lines of code that you have mentioned above will not compile because there is one set of [] missing in the variable declaration part. It should be int[][] eArr3 or int[] eArr3[] instead of int[] eArr3.