File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Garbage Collection (URGENT)! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Garbage Collection (URGENT)!" Watch "Garbage Collection (URGENT)!" New topic
Author

Garbage Collection (URGENT)!

Hama Kamal
Ranch Hand

Joined: May 29, 2011
Posts: 144

hi folks

from the K&B book (Objects that are created in a method also need to be considered. When a method
is invoked, any local variables created exist only for the duration of the method.
Once the method has returned, the objects created in the method are eligible for
garbage collection.)

my question: does that mean the Objects which are created in method are alos eligible for garbage colleciton?
if so in the below example this Objectis eligible for GC am i right?


and one more thing:
could you please tell me whtat this line is in the above code? as it gives compilation error ,,it looks like abstract method but the class is not abstract ,, so how can we invoke it there? or it's just there to show you that you can invoke some methods??


``Worry does not empty tomorrow of its sorrow; it empties today of its strength.''
Piyush Joshi
Ranch Hand

Joined: Jun 10, 2011
Posts: 207

Yes objects created in main() method will be available for garbage collection as soon as main() ends.

Don't worry about doComplicatedStuff() method call. It is not an abstract method. Its there just as a placeholder for any code that can execute in between, nothing special.


Piyush
Hama Kamal
Ranch Hand

Joined: May 29, 2011
Posts: 144

Piyush Joshi wrote:Yes objects created in main() method will be available for garbage collection as soon as main() ends.

Don't worry about doComplicatedStuff() method call. It is not an abstract method. Its there just as a placeholder for any code that can execute in between, nothing special.


thanks Piyush ,,, i got it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Garbage Collection (URGENT)!