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
What do you know about the garbage collector?
Difference between keyword and identifier.
What happens if an exception is throws from an object's destructor?
What does indexof return in java?
Does every java program need a main?
Is Java a dying language?
What is use of a abstract variable?
How many types of voids are there?
Is arraylist an object in java?
What is extension method in java?
What is the definition of tree ?
What is bufferedreader in java?
What are the different types of sorting in java?
how to open and edit XML file in Weblogic???
What is tochararray in java?