In order to understand the “finalize” method one needs to understand the concept of garbage collection.
The job of freeing up the memory allocated to objects is that of a
garbage collector. When the garbage collector determines that an object
is no longer referenced it automatically runs a special destructor
function called “Finalize”.