Do you need a destructor in Java?

In Java, the garbage collector automatically deletes the unused objects to free up the memory. Developers have no need to mark the objects for deletion, which is error-prone and vulnerable to the memory leak. So it’s sensible Java has no destructors available .

Sizin İçin Seçtik  Why do we need to overload a constructor in C++?

Leave a Reply

Your email address will not be published. Required fields are marked *