File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes when class gets unloaded? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "when class gets unloaded?" Watch "when class gets unloaded?" New topic
Author

when class gets unloaded?

hari harann
Ranch Hand

Joined: Aug 07, 2008
Posts: 54
we all know that when a class gets loaded, static block does execute and static variable exists as long as class is loaded.
but my question is when does the class gets unloaded from VM ???
please explain
[ August 16, 2008: Message edited by: Bear Bibeault ]
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Originally posted by hari harann:
we all know that when a class gets loaded, static block does execute and static variable exists as long as class is loaded.
but my question is when does the class gets unloaded from VM ???
please explain


According to the JLS, classes can only be unloaded when the ClassLoader that loaded the class is being garbage collected (and thus the classes it loaded are no longer reachable). The link above goes into more detail on the rationale.


Steve
hari harann
Ranch Hand

Joined: Aug 07, 2008
Posts: 54
thanks steve..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: when class gets unloaded?