+ 2

Distructors

is there a distracture in java and how can we use him ?

29th Nov 2016, 4:58 PM
abdulmalek dery
abdulmalek dery - avatar
1 Answer
+ 2
Because Java is a garbage collected language you cannot predict when (or even if) an object will be destroyed. Hence there is no direct equivalent of a destructor. There is an inherited method called finalize, but this is called entirely at the discretion of the garbage collector.
29th Nov 2016, 5:18 PM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar