Hi Jini,
when r we using garbage collection? and finalize()?
we have to manually run it? Or, the system will do it automatically?
I feel confuse on this section, pls help
Well, a programmer NEED NOT to call the gc explicitely, because ,
the JVM will automatically call the gc once it is conviced that a particular object cannot be accessed. However, you can
suggest the JVM to invoke the gc by calling the <code>system.gc() or Runtime.getRuntime().gc()</code>.
Same is the case for <code>finalise() </code> method. The API decalres that it is a protected method so in order to invoke this method you need to import java.lang.*; package.
This method is invoked when the a method is being is eligible for gc, the programmer can override the finalise() method, inorder to do some cleaning up. But, one thing must be borne in mind that the programmer should not assume that by calling the method will run the method at that point in time. So no judgement should be made on this point.
Hope this clears your doubt.
Ravindra Mohan.
[This message has been edited by Ravindra Mohan (edited May 30, 2001).]