Question - What Is The Relation Between Garbage Collector And Finalize And Destructor?
Answer -
here the GC calls an object's FINALIZE method immediately before it collects an object that is no longer referred by the application.
GC doesn’t actually run finalize method when the GC finds a FINALIZE method it queues the obj up for the finalizer to execute the objects method[GC checks for those resources which are no longer used by the process. To release the memory from these resources and in order to regain the memory heap GC initiates destructors to destroy such instances of the program. Before the destructor void an instance variable finalize routine gets executed. This routine performs whatever is to be done before the object return to void state or prior to release of any unused resources.]