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

Which sorting algorithm is best in java?

532


Java openings 3 - 5 years, Lnt Infotech. requirements - core java, J2ee, struts, hibernate Interview Date:- 19 March 2011 Time:- 9:00 AM to 12:00 Pm Interview Location - L & T Infotech, Manapakkam, Chennai Refererral PS NO:- 291649 (Please mention this when u fill the form only then u will be considered for interview) Documents Required:- Latest Resume, Photograph and last 3 payslips Mail me on vasan2211@gmail.com once u appear for interview

2852


What is final keyword in java?

547


Mention some features of java?

536


What is a boolean structure?

554






Is assembly language a low level language?

492


Can set contain duplicates?

546


What is the use of set in java?

610


Can static methods access instance variables in java?

571


What is the difference between super class & sub class?

562


What is wrapper class example?

533


Is there any limitation of using inheritance?

569


why using interface interface ?

1505


What is meant by object?

572


What is the name of the java compiler?

519