Java - Passing a class as a parameter
<p>I have a method that needs to create an array of objects of a certain type. Here's a part of it:</p>

<pre><code>public void myMethod() {
    for (int i = 0; i &lt; something.length; i++) {
        ViewerSorter sorter = new IdeaTableSorter(i);
        .....
        .....
    }
}
</code></pre>

<p>I want this method to work with all kinds of <code>ViewerSorter</code> objects, not just be coupled with <code>IdeaTableSorter</code>, but since I have to create a bunch of these objects I want to pass a reference to <code>myMethod</code> telling it which class to instantiate.</p>

<p>Is there a way to do this without using the Reflection API?</p>
