public class ShutdownDemo {
public static void main(String[] args) throws Exception {
// Create an Object with a finalize() method.
Object f = new Object() {
public void finalize() {
System.out.println("Running finalize()");
}
};
// Add a shutdownHook to the JVM
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
System.out.println("Running Shutdown Hook");
}
});
// Unless the user puts -f (for "free") on the command line,
// call System.exit while holding a reference to
// Object f, which can therefore not be finalized().
f = null;
System.gc();
System.out.println("Calling System.exit()");
System.exit(0);
}
}
分享到:
相关推荐
AboutTime – 古老但实用的网络校时软件
about c#.doc 关于C# 的简介 及 发展前景 about c#.doc 关于C# 的简介 及 发展前景 about c#.doc 关于C# 的简介 及 发展前景
Android About Page Create an awesome About Page for your Android App in 2 minutes This library allows to generate beautiful About Pages with less effort, it's fully customizable and supports opening ...
All About PDF 顾名思义是包含了PDF工具相关的一切功能,所以All About PDF是一款包含具备PDF合并、PDF分割、PDF保护、页面删除、水印添加、PDF解锁、PDF转换、PDF压缩等多种实用功能于一体的多功能综合性PDF工具箱...
AboutTime 时间同步,也可在局域网内做时间服务器
Joseph Y. Halpern, Reasoning about Uncertainty 2nd Edn, 2017 不确定性 推理 好书,新版
disagree about disagrees about version
很简洁又不失大气的关于我们(about)模板
100 Things Every Designer Needs To Know About People (2011)
ntp校时软件windows版本,AboutTime 是一款比较古老的软件了,尽管如此,它以其强大的功能和精巧高效,仍被很多人喜爱和使用。它既可作为校时客户端为本机校时,也可在局域网中作为校时服务器运行。常用于windows...
econ sta math hedge funds easy way about hedge funds
一款古老、高效、精准的校时小工具。AboutTime_4.8,附带能用的校时站点。
about downloads on macbook pro
AboutIt A About-page creator Install dependencies { implementation 'com.snilius.aboutit:aboutit:1.2.2' } Optionally one may also add the meta module to get some common library presets for free, like ...
一个简单的可定制的Android About页面
100 Things Every Designer Needs to Know About People,if you want to be a good programer,you shouldn't miss it.
AboutTime是时间对时软件 能够快速有效的和同网电脑对时同步等
Law What about the Future
Jounral of indexed by SCI about artificial neural networks.
About Box A modern About Box for an Android App built on the daniel-stoneuk/material-about-library. Easily display the common items of an About Box in a modern Android friendly way About Android About...