• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

GC Questions are worth for the garbage.

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I seriously hope Sun changes the ambiguity involved in Threads & GC Questions.
All Q. I feel has yes & no validations
a.you can directly run the GC whenever you want.??--t
b.GC runs in a low memory situation.--f(not always)
c.only the objects whose ref are set to null are GC.--false
d.The finalise method of the subclass has to make a call to the superclass finalise method.(is it a must)
e.The GC informs your object when it is about to be GC.
please be brief.
[This message has been edited by hema janani (edited September 26, 2000).]
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Janani,
a. You can run GC whenever u want is FALSE i suppose.
You can only request the JVM to put an effort to run
GC. System.gc() is not looked in the sameway as
System.out.println(). The former only puts a request
and JVM may or may not take up your request.
c. Only objects whose ref are set to null are GC - FALSE
since even if a object is out of scope it can be GC'ed.
In case of string Literals even if you set the reference
to null the object is not GC'ed.
d. The finalise method of the subclass has to make a callto the
superclass finalise method - TRUE.
Can anybody please explain clearly this point to me. I have
seen at many places this is true but i have not understood
why.

b,e I am not sure.

------------------
Regards,
V. Kishan Kumar
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kishan,
(d) Finalize method of a subclass need not make a call to super.finalize(). It is a good programming practice to do it. But if you don't do it, compiler won't insert any calls nor will it flag an error.
e). Not always. If the object is being garbage collected for the first time, it calls the finalize() method and that is how the object gets to know that it is being gc'ed. If you resurrect the memory, GC is not going to call finalize() again and you don't know when you are going to be GC'ed.
 
hema janani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
again 2-3 views of same Qs have started
so finally please someone confirm once that in exam if I come across the foll alternatives,all are marked as false.
a.you can directly run the GC whenever you want//false
b.GC runs in a low memory situation.--//false
c.only the objects whose ref are set to null are GC.--//false
d.The finalise method of the subclass has to make a call to the superclass finalise method.//false
e.The GC informs your object when it is about to be GC.//false

 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Ramesh. Given the statements as they are, all of them are false.
The option (e) is vaguely worded. The answer can be true or false. One can argue either way, however just don't get confused. I am 100% certain the questions in the actual exam will have definitive answers.
Where did you find this question??
Ajith
 
hema janani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I was desperately awaiting yours or maha's reply.
Thanks a million Ajith
I have collected all the theoritical Qs on GC as well as Thread
from various mock exams.out of which I had doubts on above five Qs.
I am appearing on 29th then I will post the whole database forthe benifit of others on java ranch.
no emails entertained asking for the same.
sorry to be bit rough.
thanks
hema

Originally posted by Ajith Kallambella:
I agree with Ramesh. Given the statements as they are, all of them are false.
The option (e) is vaguely worded. The answer can be true or false. One can argue either way, however just don't get confused. I am 100% certain the questions in the actual exam will have definitive answers.
Where did you find this question??
Ajith


 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow!!! that's great. Your database will surely help others and me too-for redirecting other Ranchites
Good luck for your exam.
Ajith
 
Ramesh Donnipadu
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good luck Hema.
Don't forget to let me know how it went and your experiences on what could possibly go wrong in actual test. That will help all.
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic