Is there a destructor for Java?

前端 未结 22 1598
[愿得一人]
[愿得一人] 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:40

    There is no exactly destructor class in Java, class destroyed in java automatically by garbage collector . but you could do that using below one but it's not exact same thing :

    finalize()

    There was a question that spawned in-depth discussion of finalize , so that you should get more depth if required...

提交回复
热议问题