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 do we need singleton?
How to declare objects of a class ?
Can we declare a class as static?
What are the supported platforms by java programming language?
What is a "pure virtual" member function?
Can we nested try statements in java?
Can you pass functions in java?
What is Applet Stub Interface ?
What is high level language in computer?
Can we catch more than one exception in a single catch block?
What is type inference in java8?
How do you sort objects in java?
how many types of Inheritance?
I want to persist data of objects for later use. What’s the best approach to do so?
What is module with example?