• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Objects eligible for garbage collection

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please Explain me how many OBJECTS are eligible for GARBAGE COLLECTION in following code when //dostuff is reached


This question is given the book SCJP Programmer Study Guide written by Kathy Seirra And Bert Bates.

Answer is given only 2 Objects

no.1 is Object c1 and another one is shortcut wrapper Object associated with Object c1

What is Shortcut Wrapper Object??

i am not geeting this one.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vishal mishra wrote:Please Explain me how many OBJECTS are eligible for GARBAGE COLLECTION ... ANSWER IS 2 .PLEASE EXPLAIN ME HOW??


Please EaseUp (←click).

Winston
 
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you post a question, please tell where you found it.

Did you think the answer should be more, or less than, two? Remember that when an object becomes unreachable, it becomes eligible for garbage collection. Does that help?
 
vishal mishra
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well SORRY if i wrote anything wrong .

I didn't mean that my query is "Urgent".

I just tried to make my point clear.
 
vishal mishra
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question is given the book SCJP Programmer Study Guide written by Kathy Seirra And Bert Bates.

Answer is given only 2 Objects

no.1 is Object c1 and another one is shortcut wrapper Object associated with Object c1

What is Shortcut Wrapper Object??

i am not getting this one.
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vishal mishra wrote:
What is Shortcut Wrapper Object??



It is not shortcut???

It is a Short wrapper object...Declared in the program... Short story = 200;

The Short class wraps a value of primitive type short in an object. An object of type Short contains a single field whose type is short.



For more Info.:
docs.oracle.com/javase/7/docs/api/java/lang/Short.html
 
dennis deems
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Every instance of CardBoard has an instance field named story that is a reference to a Short object. When that CardBoard instance becomes unreachable (for example, because the reference to it has been set to null) -- then what happens to the Short object that story refers to? Can it still be reached?
 
vishal mishra
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am such a BIG FOOL !!

Thanks !!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic