Author | Message |
---|---|
jtahod
Posts: 1
|
Posted 18:27 Sep 30, 2017 |
does anyone know how to initialize this constructor correctly ? i think I'm misunderstanding how it correctly implement it.
public Array2D(E array[][] ) { array = (E[][]) new Object[rows][cols];
} |
kknaur
Posts: 540
|
Posted 18:31 Sep 30, 2017 |
The array that you pass into the constructor is simply a mechanism by which you initialize the data of your Array2D object. As you are setting up the nodes for your Array2D you just copy the elements from the given array into each node of your Array2D object as you create it. Its like taking an old array and then copying the values to a new one. |