what are the differences between final,finally,finalize
methods?
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 ? | 30 Yes | 6 No |
Post New Answer View All Answers
Find the value of a specified element of the array arr[i] where 0 <= i <= n-1
Can we assign null to double in java?
What is try-with-resources in java?
Difference between operator overloading and function overloading
What is the use of static methods?
How do you define a method?
What is the synonym of string?
I am a fresher and know core java, c languge, html, css etc if I am illegible for any job then send it on my email tatranakshay276@gmail.com
What is the size of boolean variable?
What is the purpose of abstract class?
What is operator overloading. Is it is supported in java?
Is break statement can be used as labels in java?
Why are data types important?
What is the difference between access specifiers and access modifiers in java?
Make a data structure and implement an algorithm to print all the files in a directory. (The root directory can have sub-directories too.)