This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes mock: garbage collector 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 "mock: garbage collector" Watch "mock: garbage collector" New topic

mock: garbage collector

adam Lui
Ranch Hand

Joined: Sep 03, 2007
Posts: 186
source : learnKey

which request(s) that the garbage collector executes?
A. System.gc();
B. System.runGC();
C. System.getRuntime().gc();
D. Runtime.gc();
E. Runtime.runGC();
F. Runtime.getRuntime().gc();

I picked A, F in the mock exam,
but since it didnt auto save the report and i closed the software by accident,
i am not sure the answers.
Gaurav Bhatia
Ranch Hand

Joined: Jan 01, 2007
Posts: 49
A and F are correct.
Try compiling the code.

~Gaurav<br />SCJP5
Jari Timonen
Ranch Hand

Joined: Jan 16, 2004
Posts: 232
A and F are correct.

SCJP 5.0, SCJD URLyBird 1.3.3, OCMJEA 5 (SCEA) Factory Homes
Fu Dong Jia
Ranch Hand

Joined: May 23, 2007
Posts: 131
A and F are correct.

who dare win!<br />SCJP5(94%)|SCWCD5(86%)|SCBCD(100%)|SCEA in progress
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3381

Yes, A and F are correct though C seems to be so!

Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Sid Robin
Ranch Hand

Joined: Nov 24, 2007
Posts: 53
I assume option D is also right
Kelvin Chenhao Lim
Ranch Hand

Joined: Oct 20, 2007
Posts: 513
Originally posted by Sid Robin:
I assume option D is also right

Nope. Runtime's gc() method is a non-static method, so you can't invoke it without an instance of Runtime.

SCJP 5.0
I agree. Here's the link:
subject: mock: garbage collector
It's not a secret anymore!