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

Why do we use regex?

784


Is there any tag in htm to upload and download files?

853


What is java regex?

770


How do you achieve polymorphism in java?

746


Which class contains a method: cloneable or object?

792


What does snprintf return?

797


Why are global variables used?

738


What is string made of?

753


What is difference between printf and scanf?

762


Can an interface extend a class?

764


What are the advantages of packages in java?

968


Explain the reason behind ending a program with a system.exit(0)?

837


How can you make sure that your singleton class will always return single instance in multi-threaded environment?

806


What is reverse function?

811


what is thread? What are the high-level thread states? : Java thread

1047