Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Mock question for Garbage Collection" Watch "Mock question for Garbage Collection" New topic
Author

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Mock question for Garbage Collection