Hi, I need some enlightenment with copying arrays in JAVA from some of ya seasoned lots.

I have this 2d array , twoDarray[10][6] and another 1d array oneDarray[1,2,3,4,5,6]. I'd like to copy the 1d array into the 4th row of the 2d array.Suggestion please. Thnx in advance.

The twoDArray in your case is just an array of size 10 with each slot referring to a integer array i.e. two dimensional arrays in Java are just an array of arrays. Hence you can either use twoDArray[3] = oneDArray; or System.arraycopy if you don't want modifications in the original oneDArray to be reflected in twoDArray. Also read this.

thnx for the valuable input...appreciate it..muah.

The twoDArray in your case is just an array of size 10 with each slot referring to a integer array i.e. two dimensional arrays in Java are just an array of arrays. Hence you can either use twoDArray[3] = oneDArray; or System.arraycopy if you don't want modifications in the original oneDArray to be reflected in twoDArray. Also read this.

This question has already been answered. Start a new discussion instead.