title: How to understand this use of Java generics
body: <p>In my study book, there's this example:</p>
  
  <pre><code>import java.util.*;
  public class RentalGeneric&lt;T&gt; {
  
    private List&lt;T&gt; rentalPool;
  
    private int maxNum;
    public RentalGeneric(int maxNum, List&lt;T&gt; rentalPool) {
  
    this.maxNum = maxNum;
    this.rentalPool = rentalPool;
  }
  public T getRental() {
    return rentalPool.get(0);
  }
    public void returnRental(T returnedThing) {
      rentalPool.add(returnedThing);
    }
  }
  </code></pre>
  
  <p>I find it strange that it compiles, since there is no definition of <code>Class&lt;T&gt;</code>. What is the story about this? It says in my book that <code>T</code> is for the type parameter but how do I know when to use it?</p>