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
Is string an object?
what are Hostile Applets?
Tell me are there implementations for sorting and searching in the java libarary?
Why static functions are used?
How do you create an array in java?
What does java stand for?
What is final keyword in java?
explain the concept of virtual method invocation in polymorphism in detail?
What do you mean by stream pipelining in java 8?
Is an array a vector?
What is the difference between superclass and subclass?
What is compareto () in java?
How do you read a char in java?
What does this () mean in java?
What is the meaning of 3 dots in java?