• In Finalize() method mostly write the closing statement of Object, suppose if that object is connected to any outside resource such as a file, database anything, and before destruction, it has to release or it has to shut down the files or database properly so then only object destruction is possible, here Garbage Collectors thread call the finalize method before the destruction of the object.

why it is protected

  • suppose if user Ramesh has some properties either Ramesh can destroy his property or his family can destroy his properties, no anyone else from outside can destroy Ramesh properties except his family, it will not allow to outside to destroy the Ramesh properties except his family, only Ramesh hierarchy his family only allows to destroy the Ramesh properties,
  • The same way protected means to make available to next level hierarchy only,