Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Any class that includes a finalize method should invoke its superclass finalize method, why?

0
Posted

Any class that includes a finalize method should invoke its superclass finalize method, why?

0

The point is that finalize methods are not automatically “chained” – if you subclass a class that has an important finalize, your finalize method should call it. Obviously if you don’t know what the superclass finalize method does, you should call it anyway, just to be safe. By contrast, When you create an object with the new keyword, the superclass constructor(s) are called first. This is automatically “chained”.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123