How to return a generic type object in a static method
<p>i have 2 classes:</p>

<pre><code>public class Super {

    public static &lt;T&gt; T bar(Class&lt;T&gt; clazz){

        try {
            return (T)(clazz.newInstance());
        } catch (IllegalAccessException e) {           
            e.printStackTrace();
        } catch (InstantiationException e) {           
            e.printStackTrace();
        }
        return null;
    }
}
</code></pre>

<p>and</p>

<pre><code>public class Sub extends Super{

    public static void main(String[] args){
        Sub s = Sub.bar(Sub.class);

    }
}
</code></pre>

<p>now i don't want to use <code>Class&lt;T&gt; clazz</code> as a param of <code>bar</code>, so how can i return the generic type <code>T</code>, thanks.</p>
