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

How arrays are stored in memory in java?

722


What are access specifiers in java ?

802


Why put method is used?

772


How to perform bubble sort in java?

790


Should database connections be singleton?

769


What will be the output of round(3.7) and ceil(3.7)?

882


How does remove work in java?

732


Why does java have two ways to create child threads?

692


What is regex java?

803


Write java program to reverse string without using api?

760


What is use of super keyword?

755


Why singleton pattern is better than creating singleton class with static instance?

800


What is the difference between interface & abstract class?

804


Can a constructor be made final?

887


What do you mean by object?

731