Skip to main content

Why there is no 'Destructor' method in java ?


down voteaccepted
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. So for classes that need to explicitly tidy up, the convention is to define a closemethod and use finalize only for sanity checking (i.e. if close has not been called do it now and log an error).

Credit: https://stackoverflow.com/questions/171952/is-there-a-destructor-for-java

Comments

Popular posts from this blog

How to create an awesome Powerpoint slide

-- How to create an awesome Powerpoint slide -- :D   :D   Hope to watch it and like it   :D   :D         https://youtu.be/slpriQkGT-k How to create an awesome Powerpoint slide in powerpoint 2013 . This video is for making a quickest awesome . Its easy to create a this amazing powerpoint template . To subscribe : https://www.youtube.com/channel/UCzgm... To Watch more videos : https://www.youtube.com/channel/UCzgm... Put your comment about this video on Comment box :) Hope to like this video and share this video . This will inspire me to make more video . THANK YOU! #Shortcuts : Duplicate : Ctrl+D Increase Shape horizontally : shift+ Right_arrow Increase Shape vertically : shift+ Up_arrow Shapes group create : Ctrl+G(First select shapes then press ctrl+ G) #softwares: Using : Powerpoint2013 Video Edit : Camtasia8 Add music: Camtasia8 #MUSIC : Song: Rival [Top Shelf Sounds Release] Artists: Onhar Music provided by Top Shelf Sounds...

Using replace( ) function in python 3

replace( ) is used to replace or modify or reassign a new character in that string. Let's see a example because an example helps you to keep in mind that topics clearly. # Here is replace ' ' a space by a hyphen '-' # and after replacing all ' ' to '-' assign it to that string variable string = "Python Users Bangladesh" string =  string.replace(' ','-')    print (string) You can also replace characters from a string using a list. Comming Soon!

Best professional presentation slide! Powerpoint design (Project#Synergy HR Solution)

I got a project from Synergy HR Solution ( http://synergyhrsolutions.com/   ). This company massaged on my facebook page and request for a professional PPT presentation.   And i tried my best to give a awesome presentation about this company . Hope to like it Put your opinion on comment box.   Subscribe: https://www.youtube.com/channel/UCzgm... software:   #powerpoint2013 #camtasia8 music: http://nocopyrightsounds.co.uk/ https://www.youtube.com/watch?v=bM7SZ...