0

This is how the finalize() is defined in Object class: protected void finalize() throws Throwable { }

Can anyone tell me where is the code inside the method? I mean how Garbage Collector calls a method with empty body to perform cleanup activities associated with the object?

  • There is no code in there. The GC calls the method, and it *does nothing*. That is: by default. You can overwrite the method in your custom `Object` subclasses to do something. – Bergi Nov 05 '17 at 14:13
  • What cleanup activities do you expect it to do? In other words, what code did you expect to find in that method body? – the8472 Nov 05 '17 at 16:25

0 Answers0