Garbage collection of overridden method
<pre><code>class Superr {
    public void call() {
        System.out.println("SuperCall");
    }
}

public class Sub extends Superr {

    public void call() {
        System.out.println("subCall");
    }

    public void check() {
        System.out.println("check");
    }

    public static void main(String args[]) {
        Superr spr = new Superr();
        Superr sb = new Sub() {
            public void call() {
                System.out.println("anotherCall");
            }
        };
        sb.call();
        spr.call();

    }
}
</code></pre>

<p>Only the anonymous method and spr.call() gets executed not the one called by the reference variable by overriding the call mthd  sb.call() whether it has been garbage collected. </p>
