what is Destructor in OOPs ?

            unlike C++ programs java & C# programs need not be worry about killing the reference type from the heap memory because that will worked that automatically done by the garbage collector however C# is still allows us to create  own destructor for following 2 reasons

1. instead of waiting for the garbage collector if we want to clear the type immediately by out ourselves  then we can used  destructor 

2. Same way cleared when the reference type is getting if we want certain code to be executed like even showing a simple message then also we can our own destructor 

    Officially Java does't support destructor but if we create under name finalized in java then it acts like destructor 

Comments

Blogs