title: Java How to produce generic class that accepts a String and integer?
body: <p>I'm trying to get familiar with generics in java. I'm still unsure how create a simple class to take two types (String, Integer). Below is a trivial attempt at working with generics in my contexts.   </p>
  
  <pre><code>public class Container &lt;T&gt;
  {
  
    public T aString()
    {
       //Do i know I have a string?
    }
  
    public T anInt()
    {
      //How do I know I have an integer?
    }
  
    public Container&lt;T&gt;()
    {
      //What would the constructor look like?
    }
  
  
  }
  </code></pre>
  
  <p>I'm referencing this page <a href="http://docs.oracle.com/javase/tutorial/java/generics/rawTypes.html" rel="nofollow">oracle generics</a> but I'm still not sure what I'm doing here. Do you first figure out what type your "T" in the class? </p>
  
  <p>Is generic programming genuinely used for interfaces and abstract classes?</p>