what are the differences between final,finally,finalize
methods?

Answer Posted / vibhor bhatnagar

Final :
final is a Modifier
final variable is a constant.
final method cann't be overrid.
final class cann't be subclassed.

Finally :
The finally clause is used to provide the capability to
execute code no matter whether or not an exception is
thrown or caught.

Finalize:
The purpose of finalization is to give an unreachable
object the opportunity to perform any cleanup processing
before the object is garbage collected. OR An object’s
finalize() method may only be invoked once by the garbage
collector.

Is This Answer Correct ?    15 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Who developed java?

565


What is difference between equal and == in java?

518


What comes to mind when someone mentions a shallow copy in java?

655


Difference between Preemptive scheduling vs. Time slicing?

567


Describe the Big-O Notation.

613






What is static import in java?

528


What is java object name?

549


Program to Find the second largest element in an array.

583


What is difference between pointer and reference?

502


What is anagram number?

453


which pattern is default in scanner package?

1799


What is meant by singleton class?

598


What is an infinite loop?

543


How to retrieve data from database in java using arraylist?

524


When is the finally clause of a try-catch-finally statement executed?

498