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

Answer Posted / ravi

A "final" method or variable is one that can't be overridden
- you can define a method as final within a class to ensure
that any extensions to the class don't replace it.

If you add a "finally" block onto the end of a try / catch
exception handler, you're defining a block of code that will
be run if the try is entered, even if problems occur and
your method returns from within a catch rather than continuing.

A "finalize" method is your destructor method - code that's
run to clean up objects that are no longer required. For
example, objects which are memory cached would be flushed
back to the disc in your finalize.

Is This Answer Correct ?    8 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sizeof in java?

870


What are the main uses of this keyword?

818


What is api in java?

760


Differentiate storage classes on the basis of their scope?

881


What is bytecode verifier?

708


What is array command?

816


what is meant by encapsulation?

851


Where import statement is used in a java program?

828


Explain the importance of throwable class and its methods?

792


Is singleton class immutable?

732


Are maps ordered java?

716


Can list be null in java?

776


How to find the largest value from the given array.

771


What is the use of put method?

737


What is the symbol for space?

765