What Is The Purpose Of FINALIZATION In JAVA?

3

3 Answers

Saadia Samad Profile
Saadia Samad answered
The main function of finalization is to provide the opportunity to an object which is unattended or can say unreachable to complete the cleanup process task . This activity is done before the object is collected as considered as garbage .

Java is a very strong language usually used for online web activities .
It covers so many procedures and processes .

Before we go further we have to first consider that what does finalization means.

Specifically finalization means the activity taken by JVM ( Java Virtual Machines ). This is a chance to the user to check and clean up the resources before the objects get into garbage. This garbage collector is set to be responsible to regaining all the unused memory already pre-occupied by such invalid object .

Furthermore this garbage collector cannot take or provide any guarantee for not putting the program to work out of memory. It is just responsible to for all the programs to use resources of memory in faster way and after then all garbage can be collected. There is also a possibility for the programs to create such objects which are not there for been garbage is collected.
Muhammad Abdullah786 Profile
Java language is an object oriented language that is also platform independent. There are different methods for the finalization in java. It's not only Java technology helps you to use the finalize method to do the required cleanup before the garbage collector eliminates the object from memory. This method is known as the garbage collector on an object when garbage determines that there are no additional objects. It is hereditary by all classes. It's the subclass which overrides the finalize method to destroy of system resources and perform other clean up functions.

If there is uncontrolled error thrown by the finalize method, the error is ignored and finalization of that object ends. The main thing to remember is, finalize method will be raised only once in the life time of an object. However, the finalize method might never be invoked for an object in its lifetime, because there is no guarantee that it will get garbage collected.
ayesha sana Profile
ayesha sana answered
Java is an object oriented language which provides help to programmers to create objects and call them into a function a number of times and also outside of the functions.

Finalization is a function in Java which works on the object to perform the clearing process automatically.This is a built-in function and works in many tasks where it is needed to finish the processing. This means that if in Java coding provides the facility that one can assign value to the object so that the object clears the working area.

The variable of an object is created .This object is created like a hidden object or the object which no other object, variable, class and function can access. This object is assigned a code value so that it can perform the specific function.

This object has some tasks. It locates the coding and its functionalities, when ever it sees any unnecessary or waste things which are gathered in it, it starts working cleaning up the object.

Answer Question

Anonymous