class A extends B
{
C ob1=new C();
D ob2=new D();
protected void finalize()
{
System.out.println("Finalizing A");
super.finalize();
}
public static void main(String ss[])
{
new A();
System.gc();
}
}
Though System,gc() doesn't guarantee the running of finalization, my question is if the JVM is able to run the finalizations at the time of call to gc(), what will be the order of execution of the finalizations for the classes A,B,C,D (assuming that all have finalizations with a code similar to that of A's and that apart from A, none of the classes explicitly inherit).