posted 1 year ago
You better post complete code, so more people may try to answer you
You are creating an object of V2Radiator and passing a reference of object of ArrayList assigned to aList reference variable to the parameterized constructor of V2Radiator class. Hope this is the program you are talking about. Source: Head First Java Ch.9 Page No 268
Look at line no 6, aList reference variable is passed to the parameterized constructor of V2Radiator where It adds 5 new objects of SimUnit to the ArrayList object referred by aList, each object of SimUnit class having instance variable String botType assigned by value "V2Radiator" which is also passed as argument to the parameterized constructor of SimUnit class.
Elim Banda wrote:So it passes in everything in the Arraylist? what does it then do with the arraylist?
Elim Banda wrote:V2Radiator v2 = new V2Radiator(aList); //What does this statement do?