Is there a destructor for Java?

前端 未结 22 1597
[愿得一人]
[愿得一人] 2020-11-22 11:47

Is there a destructor for Java? I don\'t seem to be able to find any documentation on this. If there isn\'t, how can I achieve the same effect?

To make my question m

22条回答
  •  误落风尘
    2020-11-22 12:15

    If you're writing a Java Applet, you can override the Applet "destroy()" method. It is...

     * Called by the browser or applet viewer to inform
     * this applet that it is being reclaimed and that it should destroy
     * any resources that it has allocated. The stop() method
     * will always be called before destroy().
    

    Obviously not what you want, but might be what other people are looking for.

提交回复
热议问题