title: Java generics, type variable scope
body: <p>What's the difference between:</p>
  
  <pre><code>public &lt;E&gt;int  compareTo(E e) // first line (compilation error)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public int compareTo(E e) // second line (OK)
  </code></pre>
  
  <p>only in the second line i get through the compiler. Does it mean that it needs to be sure that that particular element is universally declared within the class?
  Otherwise you could put in any element and would not make much sense. Am I seeing it in the right way? Thanks in advance.</p>