<p>Assuming the following class stub:</p>

<pre><code>public class Foo&lt;T&gt; {
  private Class&lt;T&gt; type;

  public Foo&lt;T&gt; () {}
}
</code></pre>

<p>Can I store the generic type <code>T</code> into the field <code>type</code> in the constructor, without changing the constructor's signature to "<code>public Foo&lt;T&gt; (Class&lt;T&gt; type)</code>"? </p>

<p>If yes, how? If no, why?</p>

<p>"<code>type = T</code>" doesn't seem to work.</p>

Does
```
```
type = T.getClass();
```
```
work?