Virtual Destructor. Deleting a derived class object using a pointer to a base class that has a non-virtual destructor results in undefined behavior. To correct this situation, the base class should be defined with a virtual destructor. For example, following program results in undefined behavior. If you want to know in detail then you can get help at CodeAvail- Online Computer Science Assignment
help
We don't write destructors in JAVA as we do in C++. The removal of unused objects is taken care of by garbage collector in JAVA.
The reason destructors (the finalize method) aren't generally written in java is because finalize is very unreliable - it may never be called at all. Java doesn't have deterministic destructors.