Explain final, finalize() and finally?
Answer Posted / tarun
Any class declared by final cannot be subclassed.
Any variable declared with final its value remain constant
that is declared at the time of declaring it.
Any method declared with final in a class can not be
override with other class.
finalize() method is called by the Garbage Collector on an
object when there is no more reference to the object.
finally method is used in exception handling with try-catch
block. try block can not be used alone, it should be used at
least with catch or finally. In catch block we catch(handle)
the exception type that occured during the execution and in
finally we write some code like closing file, connection,
garbag collect any object that is of no more useful in our
application.
| Is This Answer Correct ? | 7 Yes | 2 No |
Post New Answer View All Answers
Why java is a platform independent? Explain
How many bits is a boolean?
What is the difference between == and === javascript?
How to avoid memory leak in java?
how to deploy tomcatserver to weblogic server? write d following steps?
How do you sort words in java?
Explain importance of finally block in java?
What is the method in java?
What is finalize()?
What is meant by design patterns?
What is a copy constructor in java?
Can we synchronize static methods in java?
What is an empty string in css?
What is javac_g?
How do you create a first line indent?