Hi, Programmers are advised not to depend on finalize method being called by the JVM. The EJB spec says that a bean class should not overide the method at all. I think this method should be put into a trash bin. Why should we have the method when it is of no use?
The finalize() method is sometimes used to free memory allocated by native methods - memory that wouldn't be freed by the garbage collector. They may also be used to prevent sloppy use of your class by ensuring non-memory finite resources such as file handles or sockets are released. See this related article on JavaWorld: http://www.javaworld.com/javaworld/jw-06-1998/jw-06-techniques_p.html Hope that helps, --Jase
<a href="http://www.netspade.com/" target="_blank" rel="nofollow">http://www.netspade.com/</a> - Web programming articles and tutorials.