title: Java generics - getting the type
body: <blockquote>
    <p><a href="https://stackoverflow.com/questions/2434041/instantiating-generics-type-in-java">Duplicate: Instantiating generics type in java</a></p>
  </blockquote>
  
  <p>Hi!
  I'm a c# guy giving Java a try .. so how would I do the following in java.</p>
  
  <p>in C# </p>
  
  <pre><code>public T create_an_instance_of&lt;T&gt;(){
    T instance = default (T);
   // here's usually some factory to create the implementation
     instance =  some_factory.build&lt;T&gt;();
   // or even..
     instance = some_factory.build(typeOf(T) );
  
   return instance;
  }
  </code></pre>