What is the finalize method do?



What is the finalize method do?..

Answer / Rachna Mittal

The 'finalize()' method in Core Java is called by the garbage collector just before an object is about to be destroyed. It allows you to perform any necessary clean-up or release of resources, but keep in mind that it is not guaranteed to be called and should not be relied upon for proper program behavior.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the difference between JVM and JRE?

1 Answers  


hi to all,i have a question on static block. i saved below as test.java class test extends a { static { System.out.println("test static"); } public static void main(String []dfs) { } } class a { static { System.out.println("a static"); } public static void main(String []asdf) { } } o/p as static test static but if i change base class as test class then class test { static { System.out.println("test static"); } public static void main(String []dfs) { } } class a extends test { static { System.out.println("a static"); } public static void main(String []asdf) { } } o/p test static explain me why "a static" wasn't print in second code when it is in derived class

1 Answers  


What is use of a abstract variable?

1 Answers  


What are encapsulation, inheritance and polymorphism?

1 Answers  


Can there be an abstract class with no abstract methods in it?

1 Answers  


What is the += operator called?

1 Answers  


Can a private method be declared as static?

1 Answers   Global Logic,


What is the purpose of garbage collection in java?

1 Answers  


Can we have two main methods in a java class?

1 Answers  


Can we execute java program without main method?

1 Answers  


how to make hashmap object as synchronized object?

2 Answers   BOB Technologies,


program to find 25 square = 625 here the 625 of last two digits is equal to 25, i don't know excatly what this type of number is called

1 Answers   Huawei,


Categories