Java - Classes and Objects
Why is relying on the
finalize() method for resource cleanup considered a bad practice in Java?finalize() method for resource cleanup considered a bad practice in Java?finalize() behaviorfinalize() method is called by the garbage collector but its timing is unpredictable and may never be called.finalize() execution timing is unpredictable and may never run -> Option Dfinalize() timing unpredictable = A [OK]finalize() is unreliable for cleanup, avoid using it [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions