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 class of exceptions are generated by the java run-time system?
What do u mean by variable?
What is the difference between jdk and jre?
Does sprintf allocate memory?
Can a lock be acquired on a class in java programming?
How do you insert a line break?
What are byte codes?
Difference between static synchronization vs. Instance synchronization?
What kind of variables a class can consist of?
What is yield () in java?
What is the public method modifier?
What are "class access modifiers" in Java?
Why is string class considered immutable?
What is the purpose of the System class?
Write a program to print fibonacci series