关闭应用程序时的Java Finalize方法调用 [英] Java Finalize method call when close the application

查看:66
本文介绍了关闭应用程序时的Java Finalize方法调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对finalize方法有疑问.如果我有许多具有很多继承的类,那么在应用程序关闭时如何调用所有finalize方法?

I have question regarding the finalize method. If I have many classes with many inheritances, how can I call all finalize methods when the application closing?

推荐答案

System.runFinalizersOnExit(true),但请注意,它已被弃用.如果您依靠这种事情,那么您基本上已经在做错事了.

System.runFinalizersOnExit(true), but note that it's deprecated. If you're relying on this sort of thing you're already doing something wrong basically.

这篇关于关闭应用程序时的Java Finalize方法调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆