예제
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
;