0

For example, lets have a 2D array with size 4*4

 int [][] test = {
                 {1,2,3,4},
                 {5,6,7,8},
                 {9,10,11,12},
                 {13,14,15,16},
                 };

Then how to pass the 2D array as above to an ArrayList and then if i want to print out the 2D array data as the format above, how to do that ?

However, it would be great if someone provide clear explanation.

David Adam
  • 172
  • 1
  • 12
  • 3
    And FYI, your *one* line of code won't even compile. – Nicholas K Mar 05 '19 at 04:20
  • 1
    You can use Arrays.deepToString to print out the 2D Array, to convert it into a List you can make use of for loops. See: https://repl.it/repls/OrderlyThunderousTrace – Sash Sinha Mar 05 '19 at 04:31

0 Answers0