Explain difference between final, finally and finalize?
Answer Posted / vijayakumar chinnnasamy
final:
final keyword can be applied to vairables,method,class.
fianl variable - You can't reassign/modify values to the
vaiables.
final class- You cannt extends(inherit) the class.
final method- You cannt override the final methods.
finally:
finally is used in try-catch (i.e exception handling in
java).
Each try contain only one finally blocks not more than
one.
There is no statement between catch block and try block.
It will be execute if exception is occure or not.
Mostly used for memeory release.
finalize:
This is method used to release the occupied memeory.
finally method must be protected or public otherwise
compile time error.
Is This Answer Correct ? | 74 Yes | 5 No |
Post New Answer View All Answers
What is java english?
What is anagram in java?
Which is the class in java?
What is the difference between import java.util.date and java .util?
What is the difference between notify and notifyall method?
Can private members of a base class are inheritable justify?
what is the purpose of "virtual"?
What is internal variable?
If you are given the name of the function at run time how will you invoke the function?
Tell us something about an iterator.
What happens when I use / and % with a negative numerator?
How do you convert an int to a string in java?
What about instanceof operator in java?
Can we make main() thread as daemon?
Justify your answer that you can't define a method inside another method in java, if you can then how?