System.arraycopy getting java.lang.ArrayIndexOutOfBoundsException

前端 未结 4 1745
再見小時候
再見小時候 2021-01-13 08:12

System.arraycopy getting ava.lang.ArrayIndexOutOfBoundsException.. I am trying to copy data from one array to the next. but I am getting a exception

privat         


        
4条回答
  •  青春惊慌失措
    2021-01-13 08:27

    array only has a length of 1 and you're trying to copy 8 things into it from array2. Try using an ArrayList or something that will grow as you need it to grow.

提交回复
热议问题