Confusion in multi dimensional array in Java

Posted by Alvin on Stack Overflow See other posts from Stack Overflow or by Alvin
Published on 2010-06-03T17:16:42Z Indexed on 2010/06/03 17:24 UTC
Read the original article Hit count: 156

Hello,

I'm not able to understand the following multi-dimensional code. Could someone please clarify me?

int[][] myJaggedArr = new int [][] 
{
              new int[] {1,3,5,7,9},
              new int[] {0,2,4,6},
               new int[] {11,22}
   };

May I know how it is different from the following code?

int[][] myArr = new int [][] {
             {1,3,5,7,9},
               {0,2,4,6},
                {11,22} };

© Stack Overflow or respective owner

Related posts about java

Related posts about arrays