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
How to check if a list is sorted in java?
What is the difference between static (class) method and instance method?
How define set in java?
What is listnode in java?
What is the final keyword denotes?
What are the high-level thread states in java programming?
What is the meaning of nullable?
What is functional interface in javatpoint?
What is the effect of keeping a constructor private?
What java ide should I use?
What is the use of static class?
What is the difference between throw and throws keywords?
What is fail first in java?
What is a newline character in java?
Does java trim remove newline?