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

What is the purpose of using bufferedinputstream and bufferedoutputstream classes?

556


What if constructor is protected in java?

563


What is a variable simple definition?

581


In which language java is written?

542


how do I create a runnable with inheritance? : Java thread

508






What is default exception handling in java?

577


What are the features of java?

534


Is java an ide?

528


What is static block?

594


Can we extend a class with private constructor?

527


What is singleton class in java and how can we make a class singleton?

577


Does the order of public and static declaration matter in main method?

621


How much is a java license?

526


What is string variable?

570


Explain the difference between intermediate and terminal operations in java8?

571