aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exam" Watch "Exam" New topic
Author

Exam

Hans Li
Greenhorn

Joined: Oct 13, 2000
Posts: 10
1) Which of the following statements about Java's garbage collection are true?
a) The garbage collector can be invoked explicitly using a Runtime object.
b) The finalize method is always called before an object is garbage collected.
c) Any class that includes a finalize method should invoke its superclass' finalize method.
d) Garbage collection behavior is very predictable.
I think b is ok.but answer say I am wrong.
2)What line of code would begin execution of a thread named myThread?
My answer is new myThread().start().But Answer say me wrong.I don't know.
The mock exam don't give answer key.So I need some one help me.Thank
Mary Anitha
Greenhorn

Joined: Oct 13, 2000
Posts: 23
Ques 1)Both b and C are right.
Ques 2) May be the answer they wanted is run() although we need not explicitly call run().
since start() only makes the thread eligible for execution.
but the line of code which makes the thread execute is run().
Anybody Correct me if i am wrong.
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Answer 1.(a) is also right. You can invoke the garbage collector using <code>Runtime.gc()</code> BUT that does not guarantee it will run. When you invoke the methods you're requesting that it run.
Q.2 agree with Mary

------------------
Jane


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
 
subject: Exam