how to use finalize()Method to resources

Answers were Sorted based on User's Feedback



how to use finalize()Method to resources..

Answer / rakesh

finalize() is used to release other resources
held by your object (such as database connections or
file handles)

Is This Answer Correct ?    6 Yes 2 No

how to use finalize()Method to resources..

Answer / nidhi

finalize is the method called(if defined) by garbage
collector just before it calls any object for garbage
collection. You are never sure that when will it be called.
The main aim for defining this method is to release the
resources that the object is holding before the object
could be deleted from the memory. If this method is called
then the object is not deleted from the memory in that
particular run of garbage collection but is deleted in the
next run.

Is This Answer Correct ?    3 Yes 0 No

how to use finalize()Method to resources..

Answer / srinivasa

As this method is available in object class we can override
the method and provide the code to release the resources.

Is This Answer Correct ?    0 Yes 0 No

how to use finalize()Method to resources..

Answer / sakthivel(gceb)(n.p)pollachi

finalize is one of the keyword in java.if you once declare
a method is final it can not be derived from another
class.you can use them in the form of finalize function name
()

Is This Answer Correct ?    6 Yes 12 No

Post New Answer

More Core Java Interview Questions

Can we use a switch statement with strings?

0 Answers  


Can java run on google chrome?

0 Answers  


Is java still relevant?

0 Answers  


Give few difference between constructor and method?

0 Answers  


What is numeric promotion?

1 Answers  






Why is singleton not thread safe?

0 Answers  


How can you traverse a linked list in java?

0 Answers  


How to perform merge sort in java?

0 Answers  


what ide u r using and wat version, how wil u build the project etc ?

2 Answers  


Why is singleton class used?

0 Answers  


Explain some best practices you would apply while using collection in java?

0 Answers  


Can an anonymous class be declared as implementing an interface and extending a class in java programming?

0 Answers  


Categories