+ 1

Hi who can say all thing about finalize method

16th Aug 2019, 9:52 AM
AMIR aghazadeh
AMIR aghazadeh - avatar
2 Respuestas
+ 1
@AMIR aghazadeh finalize method is called by the garbage collector however jvm uses this method only for finalizing ie closing the objects of non java function ie closing of files ..and the finalize is called only once and its important to use exceptions while using the finalize method ...the way of declaring the finalize is as protected void finalize ()thows throwable {try{ filename.close(); } }
18th Aug 2019, 12:31 PM
Aadhithya
Aadhithya - avatar