wood burning stoves 2.0
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes 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 "Garbage collection" Watch "Garbage collection" New topic

Garbage collection

Rajni Patel
Ranch Hand

Joined: Sep 03, 2009
Posts: 84
topic : Garbage collection

could you explain me what is result and how?

class Dozens{
int[] dz = {1,2,3,4,5,6,7,8,9,10,11,12};
public class Eggs{
public static void main(String[] args){
dozens [] da = new Dozebs[3];
da[0] = new Dozens();
Dozens d = new Dozens;
da[1] = d;
d = null;
da[1] = null;
// do stuff

how many objects will create and how many objects are eligible for garbage collection when line 14 is reached?
Nitish Bangera
Ranch Hand

Joined: Jul 15, 2009
Posts: 537

Well How many do you think is eligible? Also this question is discussed many times in the forums. Please search it.

[ SCJP 6.0 - 90% ] , JSP, Servlets and Learning EJB.
Try out the programs using a TextEditor. Textpad - Java 6 api
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15101

Welcome to JavaRanch.

If you search for "Dozens", you will find a few older topics in which the same question was discussed, for example:


One more important thing: When you copy a question from a book, mock exam or other source, please quote your sources - tell us where you copied it from. That's required on JavaRanch.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link: http://aspose.com/file-tools
subject: Garbage collection
It's not a secret anymore!