Why does Java not have any destructor like C++?
- by Abhishek Jain
Java has its own garbage collection implementation so it does not require any destructor like C++ . This makes Java developer lazy in implementing memory management. And Garbage Collection is very expensive.
Still we can have destructor along with garbage collector where developer can free resources and which can save garbage collector's work. This might improves the performance of application. Why does Java not provide any destructor kind of mechanism?
Developer does not have control over GC but he/she can control or create object. Then why not give them ability to destruct the objects?