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
What is OOP's Terms with explanation?
How define set in java?
What is public static void main?
Where will it be used?
define polymorphism in java
How to create an interface?
Is int primitive data type?
State some advantages of java?
In how many ways we can create threads in java?
How does a for loop work java?
Give few difference between constructor and method?
What is an empty list in java?
What type of variable is gender?
What does this () mean in constructor chaining concept?
Does a function need a return?