+ 2

Destructors in Java

Hello!! Is there a way to create destuctors in classes?? If i can't why Java doesn't support it like C++? Thanks

30th Sep 2019, 3:27 PM
CHERIEF Houcine Abdelkader
CHERIEF Houcine Abdelkader - avatar
3 Réponses
+ 7
Destructor is a special method where the "clean-up" routine is performed, the place where used resources be released, in order that other programs can use/reuse them. As I understand it, Java relies on the garbage collector to do this, and as such, no need to create a destructor because the "clean-up" chores had been taken care of by the garbage collector. Hth, cmiiw
30th Sep 2019, 4:38 PM
Ipang
0
please guide me in java
2nd Oct 2019, 5:27 AM
Rahila