Debugging to Understand Finalizer–reference

This post is covering one of the Java built-in concepts called Finalizer. This concept is actually both well-hidden and well-kNown,depending whether you have bothered to take a look at the java. lang.Object class thoroughly enough. Right in the java. lang.Object itself,there is a method called finalize(). The implementation of the method is empty,but both the power and dangers lie on the JVM internal behavIoUr based upon the presence of such method.

When JVM detects that class has a finalize() method,magic starts to happen. So,lets go forward and create a class with a non-trivial finalize() method so we can see how differently JVM is handling objects in this case. For this,lets start by constructing an example program:

Example of Finalizable class

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>