Answer Posted / 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 |
Post New Answer View All Answers
What is the difference between procedural and object-oriented programs?
Do you need to import math in java?
What is anti pattern in cyber security?
What is method overloading with type promotion?
Can a class have multiple constructors?
What are parameters in a method?
What are the fileinputstream and fileoutputstream?
What is use of a abstract variable?
Explain 5 features introduced in jdk 1.7?
What is field name?
What is the difference between assignment and initialization?
Can this keyword be used to refer static members?
Why char array is favored over string for the storage of passwords?
What are streams?
What is string builder in java?