java overloaded method
<p>I have an abstract template method:</p>

<pre><code>class abstract MyTemplate
{
    public void something(Object obj)
    {
        doSomething(obj)

     }

    protected void doSomething(Object obj);

}

class MyImpl extends MyTemplate
{

   protected void doSomething(Object obj)
   {
      System.out.println("i am dealing with generic object");
   }

   protected void doSomething(String str)
   {
      System.out.println("I am dealing with string");
   }
}


public static void main(String[] args)
{
   MyImpl impl = new MyImpl();
   impl.something("abc"); // --&gt; this return "i am dealing with generic object"

}
</code></pre>

<p>How can I print "I am dealing with string" w/o using instanceof in doSomething(Object obj)?</p>

<p>Thanks,</p>
