title: Why making generic instance is possible and generic array doesn't by using new-operator in JAVA
body: <pre><code>class Sample&lt;T&gt; {
      T[] arr = new T[5];
  </code></pre>
  <p>As I know, new-operator must know the type of T in compile time, so the above code makes an error.</p>
  <pre><code>class Sample&lt;T&gt; {
      ArrayList&lt;T&gt; list = new ArrayList&lt;T&gt;();
  </code></pre>
  <p>I think new-operator in this code also doesn't know the type of T in compile time.<br />
  So, at the same context, I think this code should make an error, but it doesn't.</p>
  <p>I don't know why. Please help.</p>