This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

HeadFirst Java Page 268 5 minute mystery Urgent Help

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please look at this code and explain to me what is happening when v2 object is created what does (alist) mean I have never come across this??

 
Ranch Hand
Posts: 186
1
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Elim Banda wrote:Please look at this code and explain to me what is happening when v2 object is created what does (alist) mean I have never come across this??



All that is happening is that you are creating a new V2Radiator object and passing it an ArrayList parameter.
 
Elim Banda
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So it passes in everything in the Arraylist? what does it then do with the arraylist?
 
Bartender
Posts: 1249
87
Hibernate jQuery Spring MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Elim Banda wrote:So it passes in everything in the Arraylist? what does it then do with the arraylist?


  • You better post complete code, so more people may try to answer you

  • Elim Banda wrote:V2Radiator v2 = new V2Radiator(aList); //What does this statement do?


  • 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.
  • reply
      Bookmark Topic Watch Topic
    • New Topic