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


Please Help Members By Posting Answers For Below Questions

Is string an object?

636


what are Hostile Applets?

1591


Tell me are there implementations for sorting and searching in the java libarary?

586


Why static functions are used?

559


How do you create an array in java?

518






What does java stand for?

534


What is final keyword in java?

545


explain the concept of virtual method invocation in polymorphism in detail?

1704


What do you mean by stream pipelining in java 8?

728


Is an array a vector?

541


What is the difference between superclass and subclass?

533


What is compareto () in java?

531


How do you read a char in java?

450


What does this () mean in java?

534


What is the meaning of 3 dots in java?

675