title: How are Java generics different from C++ templates? Why can't I use int as a parameter?
body: <p>I am trying to create</p>
  
  <pre><code>ArrayList&lt;int&gt; myList = new ArrayList&lt;int&gt;();
  </code></pre>
  
  <p>in Java but that does not work.</p>
  
  <p>Can someone explain why <code>int</code> as type parameter does not work?<br>
  Using <code>Integer</code> class for <code>int</code> primitive works, but can someone explain why <code>int</code> is not accepted?</p>
  
  <p>Java version 1.6</p>