Home » Java Object finalize() Method with Examples

Java Object finalize() Method with Examples

by Online Tutorials Library

Java Object finalize() Method

Finalize() is the method of Object class. This method is called just before an object is garbage collected. finalize() method overrides to dispose system resources, perform clean-up activities and minimize memory leaks.

Syntax

Throw

Throwable – the Exception is raised by this method

Example 1

Test it Now

Output:

2018699554  end of garbage collection   finalize method called  
Next TopicJava Object Class

You may also like