How can I dynamically create a new instance of an object in Java?
<p>I have a class called <code>GetInput.java</code>
and I have a class called <code>GetNotReleasedInput.java</code>.
I extend <code>GetInput</code> in <code>GetNotReleasedInput</code>.
In <code>GetInput</code>, I call a private function called <code>addLineToArray()</code>
and in that function I define a new class which contains details about the import.</p>

<p>However since I'm creating a generic class(<code>GetInput</code>) for <em>all</em> input files,
I cannot say in <code>addLineToArray()</code>:</p>

<pre><code>AAData nextData = new AAData();
</code></pre>

<p>because I have AA / Not Released, and in this case it should be NotReleased.
So how can I dynamically make that new <code>nextData</code> in that function?</p>
