title: Java: Using generics to implement a class that operates on different kinds of numbers
body: <p>So, let's say I want to write a class that operates on different kinds of numbers, but I don't a priori know what kind of numbers (i.e. ints, doubles, etc.) I will be operating on.</p>
  
  <p>I would like to use generics to create a general class for this scenario.  Something like:</p>
  
  <pre><code> Adder&lt;Double&gt; adder = new Adder&lt;Double&gt;();
   adder.add(10.0d, 10.0d);   // = 20.0d
  </code></pre>
  
  <p>But, I cannot instantiate the generic type I pass in to my Adder class!  So -- what to do?</p>