Garbage Collection in Java | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Garbage Collection in Java

Hi, I have some questions concerning the Garbage collection in Java. When we use the finalize() method in our program, the JVM can ignore the request ? And how many times it can be called.

16th Aug 2018, 9:12 AM
Dababi Mohamed Amine
Dababi Mohamed Amine - avatar
1 ответ
+ 1
Finalize is a normal method, you can call it as often as you want. The gc will call it once before it deletes the object, but running .finalize yourself does not trigger the gc to run.
16th Aug 2018, 10:09 AM
Schindlabua
Schindlabua - avatar