Why does Java not support destructors?

  1. Since Java has inbuilt garbage collector for memory cleanup.
  2. Java has finalize method which gets called before an object is garbage collected pretty much similar to C++ destructor.
  3. To prevent the integrity of heap which my be affected by manual object deletion.

Regards,

SPS

http://sps-tech.in/blog-for-insights-on-java-and-related-technologies-like-aws-and-machine-learning/

By spstech

Leave a Reply

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