title: toString() method using generics
body: <p>I am new to using generics. I want to print out a pair of Integers and Strings. Here is my code:</p>
  
  <pre><code>public class Pair&lt;T&gt; {
  
  private T first;
  private T second;
  
  public Pair(T first, T second) {
      this.first = first;
      this.second = second;
  }
  
  public T getFirst() {
      return first;
  }
  
  public T getSecond() {
      return second;
  }
  
  public void setFirst(T first) {
      this.first = first;
  }
  
  public void setSecond(T second) {
      this.second = second;
  }
  public &lt;T&gt; void toString(Pair&lt;T&gt; k) {
  System.out.println(k.getFirst());
  System.out.println(k.getSecond());
  }
  
  
  
  }
  
  
  public class TestPair {
  
  public static void main(String[] args) {
      Pair&lt;String&gt; pS = new Pair&lt;String&gt;("yay", "it worked" );
      Pair&lt;Integer&gt; pI = new Pair&lt;Integer&gt;(1, 2);
      pS.toString();
      pI.toString();
  
  }
  
  }
  </code></pre>
  
  <p>At the moment, it compiles but upon running TestPair class, I don't get anything printed out.</p>