jQuery in Action, 2nd edition
The moose likes Beginning Java and the fly likes How many Objects are garbage collected? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "How many Objects are garbage collected?" Watch "How many Objects are garbage collected?" New topic
Author

How many Objects are garbage collected?

Thomas Markl
Ranch Hand

Joined: Mar 08, 2001
Posts: 192

C:\Java\EigeneJavaProgramme>java GarbageCollector1
i2 == i1: true
i1 =null i2 =null
I think 2 objects (Integer(1) and Integer(2) are eligable for gc.
Is it correct?
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8439
Thomas -
unless you've buried something tricky in there somewhere, you are right - two objects are g.c. eligible.


Eliminate fossil fuel subsidies. (If you're not on the edge, you're taking up too much room.)
 
 
subject: How many Objects are garbage collected?
 
Threads others viewed
Accessing Weakly Referenced Objects
Clarification on Garbage Collection
Object References & GC
What is the diff. b/w "==" and ".equals( )" Operators
MyEclipse, The Clear Choice