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 vector?

591


How do you get the length of a string in java?

523


How to print nodes of a Binary tree?

1756


What is file in java?

564


Can an object be null?

551






What is lexicographically smallest string?

603


What is identifier in java?

561


How does java enable high performance?

695


How to sort a collection of custom Objects in Java?

603


Is 0 true or is 1 true?

519


What are identifiers in java?

577


What two classes are used to read data only?

643


What is difference between printf and scanf?

523


How do you reverse a word in java?

533


What is difference between pointer and reference?

510