What is finalizer

In this topic, you will learn about, What is finalizer.

Finalizer work as a destructor for language. It offers the facility to destroy object memory. Each java program automatically calls the finalizer method without declaration and it also supports using the finalize keyword.

It is a special member function of a class called automatically when the object goes out of scope. This method cannot use any argument .so, we can’t overload the finalizer. It cannot use the access specifier and return type. we cant call the finalizer a normal function.

Syntax:

Finalize
{
Statement;
Statement;
}

Comment below if you have queries related to the above topic, What is finalizer.

See also  Features And Applications Of OOPs