Garbage collection, Finalization and Finalize method in Java

Garbage collection: In Java, de-allocation of the memory is done automatically. This process is known as garbage collection. In this process when there’s no reference to an object is found then memory is de-allocated for that object.

Finalization and Finalize method: Finalization is a process to manage resources before an object is destroyed. For this process finalize() method is called before garbage collection where actions could be specified before a particular object is destroyed.


protected void finalize( )


finalization code;


Leave a Reply