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 object-oriented paradigm?

868


Which method you will use to create a new file to store some log data. Each time a new log entry is necessary, write string to the file in java ?

943


Differences between external iteration and internal iteration?

893


What is a variable in java?

764


Who is the owner of java?

785


What is json parser in java?

838


What is the diffrence between inner class and nested class?

850


What is thread life cycle?

743


How to run a JAR file through command prompt?

986


Explain about wait() method?

810


What is the importance of main method in Java?

826


What is join () in java?

759


what is the difference between a threads start() and run() methods? : Java thread

793


Can java hashmap have duplicate keys?

752


What are runtime exceptions?

938