top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between final, finally and finalize methods in Java?

+1 vote
701 views
What is the difference between final, finally and finalize methods in Java?
posted Dec 11, 2014 by Joy Nelson

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

The keyword is final.sss

It is used for declaring a constant

It prevents a class from producing subclasses.

finally is a code.

It always executes when the try block is finished,
Unless System.exit() has been called.

finalize() is a method,

Before discarding by the garbage collector it is invoked .

answer Dec 12, 2014 by Karthick.c
0 votes

To be concise
Final keyword is used for making constants and declaring a method inheritable...
Finally is a block and is used in try catch block,and
Finalize() is used in garbage collector...

answer Dec 18, 2014 by anonymous
...