範例
protected void finalize() throws Throwable {
try {
getApplet().destroy();
}
finally {
super .finalize();
}
}

private Applet getApplet() {
if (_applet == null) {
_applet = new Applet();
}
return _applet;
}

private Applet _applet = null;
解決方案
使用明確呼叫的清理方法,代替 finalize() 方法。
protected void free() {
getApplet().destroy();
}

private Applet getApplet() {
if (_applet == null) {
_applet = new Applet();
}
return _applet;
}

private Applet _applet = null;