• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

K&B Chapter 5 - Self Test Question # 10

 
Brian Brumpton
Ranch Hand
Posts: 40
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The questions states:

Given:
What is the result?

Just need some clarification on this one. Is it correct to say that when go() returns to the calling method that ba[0] refers to b2 and ba[1] refers to b1? Then ba[0] gets reassigned to b1 on line 9?


 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brian Brumpton wrote:Is it correct to say that when go() returns to the calling method that ba[0] refers to b2 and ba[1] refers to b1?

That's kind of difficult, because outside the go method, there's no reference variable b2 But you are correct, if you pass 2 Box instances x and y to the go method, a Box array is returned with y as 1st element (index 0) and x as 2nd element (index 1).

Brian Brumpton wrote:Then ba[0] gets reassigned to b1 on line 9?

Correct!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic