This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q 10, Self test, K and B.

 
K Raj Kumar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

Output: 4 4

Source: SCJP 6.0 guide(K and B), page 274.
Please help me in understanding the output.
Thanks in advance.
 
jean-gobert de coster
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, b1 has a size of 5 and b2 has a size of 6, then the go method modified b1 so its size is 4 and then returned a Box[] containing {b2, b1}

then ma[0] = b1 so this is the same as saying b2 = b1

so b1.size = 4 and b2.size = 4, hence the output
 
K Raj Kumar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jean..

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic