Explain final, finalize() and finally?
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 ? | 4 Yes | 11 No |
Post New Answer View All Answers
Why is core java important?
Can you sort a string in java?
How many decimal digits is 64 bit?
Give us a program to check for parenthesis matching using stack.
How can we make copy of a java object?
Explain about arraylist?
What is a arraylist in java?
How does enum work in java?
What is difference between hashset and hashmap in java?
What are the different data types in java?
What is the method in java?
What are parsers? Dom vs sax parser.
What is a class reference?
What is meant by memory leak?
What is string value?