It's not a secret anymore!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes GC Question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "GC Question" Watch "GC Question" New topic
Author

GC Question

Nisheeth Kaushal
Ranch Hand

Joined: Jul 20, 2001
Posts: 87
Hi all look at the code below
public class Question08 {
public static void main(String[] args) {
Question08 q08 = new Question08();
q08.doSomething();//line 1
Thread.sleep(20000);
}
public void doSomething(){
Object[] objArray = new Object[2];
for(int i=0;i<objArray.length;i++){
objArray[i] = new Object();
}
}
}

The answer is 3 can anzone pls explain me the reasons thanx in advance.
Nisheeth
Jamal Hasanov
Ranch Hand

Joined: Jan 08, 2002
Posts: 411
Nisheeth,
This question has already discussed:
http://www.coderanch.com/t/236958/java-programmer-SCJP/certification/Valentin-mock
Jamal Hasanov
www.j-think.com
Manish Kumar
Ranch Hand

Joined: Apr 15, 2002
Posts: 53
Hi, Nisheeth
I think something is missing in your question.. Please repost the complete question.
regards
-Manish
Nisheeth Kaushal
Ranch Hand

Joined: Jul 20, 2001
Posts: 87
Thanx Jamal for discussion link.
Bye.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: GC Question
 
Similar Threads
Another garbage collection question
Question on garbage collection
New SCJP mock exam
Question 8 Valentin's mock
garbage collection