IntelliJ Java IDE
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question for varargs for array and garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Question for varargs for array and garbage collection" Watch "Question for varargs for array and garbage collection" New topic
Author

Question for varargs for array and garbage collection

PujaR Agarwal
Greenhorn

Joined: Mar 30, 2009
Posts: 14


The following is from Mr. Devaka's ExamLab SCJP Simulator :
Practice Exam 1, question 42:

How many objects are eligible for the Garbage Collector, after executing the line-9 of this programm. F.Y.I: Array is an object.



According to ExamLab the answer is: 0


This problem is already discussed here but one forum is showing answer 1 and one is showing 0. which is true ? Can anyone help me.


Solution 1 :http://www.coderanch.com/t/418039/Programmer-Certification-SCJP/certification/about-Garbage-Collection-from-ExamLab#1843490

Solution 2 : http://www.coderanch.com/t/431013/Programmer-Certification-SCJP/certification/Devak-ExamLab-Garbage-Collection#1914089



Thanks
Puja
Devaka Cooray
Saloon Keeper

Joined: Jul 29, 2008
Posts: 2595

When did you download examlab? Before April, or After April?


Author of ExamLab - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
PujaR Agarwal
Greenhorn

Joined: Mar 30, 2009
Posts: 14
I downloaded examlab after april only but it is showing 19/4/09 version.
Devaka Cooray
Saloon Keeper

Joined: Jul 29, 2008
Posts: 2595

PujaR Agarwal wrote:I downloaded examlab after april only but it is showing 19/4/09 version.


Then please read the question again:
How many "objects of Gabc class" are eligible for the Garbage collector, after executing the line-9 of this program?

The correct answer is 0 in this case.

(There was a small error in the previous version)
PujaR Agarwal
Greenhorn

Joined: Mar 30, 2009
Posts: 14
Thanks Devaka to make it clear.
 
 
subject: Question for varargs for array and garbage collection
 
Threads others viewed
SCJP
var-args
Devak ExamLab - Garbage Collection
Exam lab question 42
Question about Garbage Collection from ExamLab
developer file tools