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
Explain the differences between static and dynamic variables?
How will you reverse a link list without using recursion?
Is set thread safe java?
Does variable declaration allocate memory?
What are bind parameters?
what is instanceof operator used in java?
Why are the objects immutable in java?
What do you understand by the term singleton?
What is foreach loop in java?
What is java command?
How does map works in java?
Implementations of set interface?
What does || || mean in math?
List out benefits of object oriented programming language?
What methods are used to get and set the text label displayed by a button object?