What is the role of finalize()?
Finalize() is used for garbage collection. It’s called by the Java run environment by default to clear out unused objects. This is done for memory management and clearing out the heap.
🔗Reference: stackoverflow.com
🔗Source: Java Interview Questions and Answers