Explain final, finalize() and finally?

Answer Posted / sunil

final variable is a constant.
final method cann't be overrid.
final class cann't be subclassed.

finally is a block usually used to release all the
resources utilized inside the try block such as to free
resources like stream objects, to close sockets .The code
in finally block is guaranteed of execution
irrespective of occurrence of exception catched/uncatched.

finalize() is never run more than once on any object.
finalize method is called by the garbage collector on an
object when the garbage collector determines that there are
no more references to the object.

Is This Answer Correct ?    4 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is formatted output in java?

499


Explain what do you mean by functional overloading in java?

557


Why does java does not support multiple inheritance? Explain

549


What is an empty class? What functionality does it offer in Java?

674


How to do a true java ping from windows?

615






5 Coding best practices you learned in java?

636


What happens if an exception is throws from an object's destructor?

581


What is difference between null and void?

531


How to use arraylist in java netbeans?

512


Using callable statement how can you pass out parameters, explain with example?

590


FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?

2637


Is static variable stored in heap?

507


What is abstraction in java?

619


Why constructor has no return type?

638


Write a program to print 15 random numbers using foreach of java 8?

545