Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.
Java does not support destructors, but adds a finalize( ) method which are invoked by the garbage collector prior to reclaiming the memory hold by the object which has the finalize( ) method. you do not know when the objects are going to be finalized. Try Avoiding use of finalize( ) method to release non-memory resources like file handles, sockets, database connections because the platform has only a finite number of these resources, and you do not know when the garbage collection is going to invoked in to release these resources through the finalize( ) method.
C++ requires explicit memory management while Java has automatic garbage collection.