Javatpoint Logo
Javatpoint Logo

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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA