Explain difference between final, finally and finalize?
Answer Posted / ranganathkini
When a class is marked final, it cannot be subclassed. When
a method is marked final, it cannot be overridden by the
subclass. And when a field is marked final, its value once
set, cannot be reset.
finally is the last clause in a try...catch block. It is a
block of statements that is executed irrespective if or if
not an exception was caught in the preceding try block.
finalize is a reserved method in Java, which can be
overridden by classes containing code to release any
expensive resources being held to by the object. Expensive
resources include, native peer objects, file/device/database
connections.
Is This Answer Correct ? | 64 Yes | 13 No |
Post New Answer View All Answers
What is difference between static variable and global variable?
What are 5 boolean operators?
If two threads have same priority which thread will be executed first ?
how we can make a write-only class in java?
Can we override protected method in java?
Explain about java sdk?
Justify your answer that you can't define a method inside another method in java, if you can then how?
What is the protected method modifier?
What is a percentage sign called?
Explain an intermediate language?
How do you print array in java?
Is void a return type?
What is difference between classpath and path variables in java?
Tell me how many ways are there to initialise an integer with a constant.
What is meant by javabeans?