if i want to dereference an object(using delete operator) of DERIVED class which is being referenced using a BASE class reference, which destructor would b called automatically??
BASE class destructor or DERIVED class destructor??
Are you sure you are talking about Java? Java doesn't have destructors. It has a finalise() method, which is of roughly zero use. If you have finished with an object just ensure there are no remianing references to it. If you have a reference variable that won't go out of scope, just set it to null.
Java has no destructor. If you want to dereference an object of DERIVED class, you may assign a null to the reference of the object so that calling the System.gc() will return the corresponding space to the OS sometime later. The garbage collector soon or later will collect it no matter if you put the line code: System.gc() or not.
Beware of the finalise() method - it's totally unreliable - there are no guarantees as to when it will be called, and it may never be called at all (eg after a System.exit(), or if another finalise on the same thread throws an exception).