File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Mock question for Garbage Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Mock question for Garbage Collection" Watch "Mock question for Garbage Collection" New topic

Mock question for Garbage Collection

Sam Sunamin
Ranch Hand

Joined: Mar 16, 2007
Posts: 113
From Whizlabs,

My answer for it is C since s refer to other object(Hello World) not the object created on line 1, so the object is eligible to collection.

Am I right? Please help me to confirm.

Thank you.

Yours Sam<br />SCJP5.0 97%<br />SCBCD5.0 72%
megha joshi
Ranch Hand

Joined: Feb 20, 2007
Posts: 206
Yes you are right . C is the correct answer.

One more thing...K&B book states garbage collection with strings is not included in exam.
I agree. Here's the link:
subject: Mock question for Garbage Collection
It's not a secret anymore!