How to use destructor in java? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

How to use destructor in java?

I knew destructor is represented with '~' but here I gets error so can anyone tell me how to use I and how to declare it ?

2nd Jun 2020, 10:54 AM
Nikhil Maroju
Nikhil Maroju - avatar
2 Respuestas
+ 1
java has not got it, there are other ways eg try(), but you can still overriding Object.finalize() method - but it's deprecated https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/lang/Object.html#finalize()
2nd Jun 2020, 11:27 AM
zemiak
0
Thank you zemiak
2nd Jun 2020, 11:53 AM
Nikhil Maroju
Nikhil Maroju - avatar