java - How i could save an array[] to an array[][] with two dimensional -


i had create array[] , save in firsti column! had wrote code:

string[][] sundaysounds = {{"0","0"}};   string[] sundayarray = {"0"};  ........  (int i=0;i<sundayarray.length;i++)     {            sundaysounds[0][i] = sundayarray[i];   <--line 39         system.out.println(sundayarray[0][i]);     } 

and error output:

exception in thread "main" java.lang.arrayindexoutofboundsexception: 2 @ test.main(test.java:39)

arrays in java start @ position 0, not position 1.

string[][] sundaysounds = {{"0","0"}};           string[] sundayarray = {"0"};           (int i=0;i<sundayarray.length;i++)             {                    sundaysounds[0][i] = sundayarray[i];//changed index                 system.out.println(sundayarray[i]);             } 

Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -