This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Q 10, Self test, K and B. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Q 10, Self test, K and B." Watch "Q 10, Self test, K and B." New topic
Author

Q 10, Self test, K and B.

K Raj Kumar
Greenhorn

Joined: Sep 16, 2008
Posts: 17
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.


With Regards,<br />K.Raj Kumar.
jean-gobert de coster
Ranch Hand

Joined: Dec 04, 2008
Posts: 49
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

Joined: Sep 16, 2008
Posts: 17
Thanks Jean..

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Q 10, Self test, K and B.
 
Similar Threads
one more question in GC
Array references as arguments in overloaded methods
Dans Garbage Collection
Mock question.
static variable vs final variable!