ArrayList of ArrayLists (dynamic 2D array) of custom class

By “copy” you actually mean “clone”.

That is, rather than assigning a copy of the same value from right to left C/C++ would clone an object, thus generating a new value, which is then assigned to the left variable.

In Java cloning isn’t done automatically. We’d need to code a function for it.

2 Likes