In the proceeding code I want to force the finalize method to run for 'a'
(a reference of Type 'A' that is pointing to and object of type 'B') when
it is assigned a null. I want to verify that the finalize method for class
B will run and that the output will be "class B". As it stands, there is
no output when the code is run.

What am I doing wrong?

class A {
int x;
protected void finalize () throws Throwable {System.out.println(" class
A");}
}


class B extends A{
int x;
protected void finalize () throws Throwable {System.out.println(" class
B");}
public static void main (String [] args) {
A a = new B();
a = null;

System.runFinalization();
System.gc();
}
}