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
How to instantiate static nested classes in java?
What is the properties class in java programming?
how would you implement a thread pool? : Java thread
Is math class static in java?
What is general methodology?
What are implicit objects in java?
What is the function of log?
Is java type safe?
What is instance example?
What do you understand by synchronization?
Why do we need hashset in java?
Is there any difference between synchronized methods and synchronized statements?
What does || mean in code?
how a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion... ANS:--- >executeupdate method is having boolean return type, if anything goes wrong in data insertion or data updation, it would return false. otherwise, if it successfully inserts data into the database, it would return true NOW HOW TO I CHECK IN MY DURING EXECUTION WHETHER IT RETURNS TRUE OR FALSE... WELL IT WILL DISPLAY ANY MESSAGE OR NOT
What are some alternatives to inheritance?