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
What are the drawbacks of singleton class?
What is an example of a boolean?
What is java dot?
what is use of functional interface in java 8?
Can we override a variable in java?
Explain wrapper classes in java?
In a container there are 5 components. I want to display all the component names, how will you do that?
What is the use of predicate in java 8?
What is a void method?
What are the steps involved to write rmi based programs?
Is there a case when finally will not execute?
What are format specifiers in java?
Can you sort a string in java?
Why can't you declare a class as protected?
Where can i get Latest SUN Certification Dumps and what are the Sun Certification Codes that are available, Im new to JAVA, so please gimme info as i need to write J2EE - Core Java Certification