This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock: garbage collector

 
adam Lui
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A and F are correct.
Try compiling the code.
 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A and F are correct.
 
Fu Dong Jia
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A and F are correct.
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, A and F are correct though C seems to be so!
 
Sid Robin
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume option D is also right

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#gc()
 
Kelvin Chenhao Lim
Ranch Hand
Posts: 513
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sid Robin:
I assume option D is also right

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#gc()


Nope. Runtime's gc() method is a non-static method, so you can't invoke it without an instance of Runtime.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic