How to infer subtype in supertype
<p>Say you have a super-class. In that super class you want to pass runtime object of itself (<code>this</code>) as a parameter to an overloaded method. Trick is, this overloaded method is overloaded by sub-class type. When you try to do it, you'll get a </p>

<blockquote>
  <p>method ... is not applicable(actual argument
  ... cannot be converted to ... by method invocation
  conversion)</p>
</blockquote>

<p>Instead you would need to implement the method separately in each subtype (just to get the correct runtime class), which is a lot of duplicate effort when the contents of the method are identical. </p>

<p>e.g:</p>

<pre><code>public class InferTypeTest {

    public static void main(String[] args) {
        SubClass1 s1 = new SubClass1();
        s1.sayHi();
    }

    public static void sayHi(SubClass1 clz) {
        System.out.println("clz 1");
    }

    private abstract static class SuperClass{
        public void sayHi() {
            InferTypeTest.sayHi(this);
        }
    }

    private static class SubClass1 extends SuperClass{

    }

}
</code></pre>
