Explain difference between final, finally and finalize?

Answer Posted / vijayakumar chinnnasamy

final:
final keyword can be applied to vairables,method,class.
fianl variable - You can't reassign/modify values to the
vaiables.
final class- You cannt extends(inherit) the class.
final method- You cannt override the final methods.

finally:

finally is used in try-catch (i.e exception handling in
java).
Each try contain only one finally blocks not more than
one.
There is no statement between catch block and try block.
It will be execute if exception is occure or not.
Mostly used for memeory release.

finalize:
This is method used to release the occupied memeory.
finally method must be protected or public otherwise
compile time error.

Is This Answer Correct ?    74 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is java beans?

578


Is empty string in java?

544


What are the 6 mandatory procedures for iso 9001?

533


What do you mean by compiler?

587


How many bytes are there?

544






What 4 doubled?

544


if u open login & logout ,how can udisplay the timelogin & logout members ?

1756


How do you make an arraylist empty in java?

483


What is udp in java?

537


String class is defined under which package in java?

625


Is java hard to learn?

465


Explain about automatic type conversion in java?

573


Write down program for following scenario. Use java coding standard. You have array list with some words in it..we will call it as dictionary….and you have a arbitrary string containing some chars in it. You have to go through each word of dictionary and find out if that word can be constructed with the help of chars from arbitrary string given. If you find the word print it else print none.

2286


How to compare strings in java?

508


Is alive method in java?

508