How to destroy object in itself

前端 未结 4 754
再見小時候
再見小時候 2021-02-18 18:05

Is there any solution for destroying current instance of object in itself ?

I am looking for something which looks like:

class KillMe {
    ....
    pub         


        
4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-18 18:44

    Java objects live until there are no longer any references to them. Since an object cannot determine how many references there are to itself, an object cannot "destroy itself".

提交回复
热议问题