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
Why is logger singleton?
Does java support Operator Overloading?
what do you mean by classloader?
Define a java class.
What are triggers in DB? Explain their types. How do they work?
What is difference between jdk,jre and jvm?
What is composition in java?
Explain the features of interfaces in java?
Can arraylist contain null values?
Explain about main thread in java?
When the constructor of a class is invoked?
Difference between method overloading and method overriding in java ?
Is null function in java?
Define an applet in java?
What access modifiers can be used for class ?