what are the differences between final,finally,finalize
methods?
Answer Posted / sunil
final variable is a constant.
final method cann't be overrid.
final class cann't be subclassed.
finally is a block usually used to release all the
resources utilized inside the try block such as to free
resources like stream objects, to close sockets .The code
in finally block is guaranteed of execution
irrespective of occurrence of exception catched/uncatched.
finalize() is never run more than once on any object.
finalize method is called by the garbage collector on an
object when the garbage collector determines that there are
no more references to the object.
| Is This Answer Correct ? | 30 Yes | 6 No |
Post New Answer View All Answers
Explain about interrupt() method of thread class ?
How to instantiate static nested classes in java?
What are the Static and Dynamic Variables? Differentiate them.
Can a class be protected in java?
When should a function throw an exception?
What is final keyword in java? Give an example.
In which language java is written?
What is an image buffer?
What are the methods available in a class?
Is empty list java?
What is the use of math abs in java?
What are three advantages of using functions?
Can inner class extend any class?
What are the different data types in java?
Enlist diffrent types of inheritance supported by java?