what is the use of finalize()Method
please explain with an example

Answer Posted / mrudang

Sometimes u have seen that some objects of java need to
perform an non- java resoures like file handler etc..

Now Suppose that object going to distroy.So java provides
the mechanism that some specific action will perform when u
delect or try to distory that object..

The opration that u want to perform when such kind of
object Distory is written in finalize method...

Is This Answer Correct ?    12 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is nested top-level class?

585


In the below example, how many string objects are created?

567


Explain how to convert any java object into byte array.

560


Can we make main() thread as daemon?

588


Are floats faster than doubles?

576






how to handle exceptions in ejb?

1884


Can you override private or static method in java?

560


What is an association?

559


Why Java doesn’t support multiple inheritance?

645


Is class is a data type?

582


Are arrays static in java?

596


Which java ide is used the most?

516


Is java se open source?

582


Why synchronization is important in java?

576


How to declare objects of a class ?

593