title: (Generics)Cannot make a static reference to the non-static type T
body: <p>running the Demo class will invoke a static method newInstance in SomeClass to call the constructor and printing hello</p>
  
  <p>defining a method will include a return type + method name with arguments</p>
  
  <p>the return type for newInstance is &lt;T>SomeClass&lt;T> seems weird to me
  since my class is called SomeClass&lt;T> instead of &lt;T>SomeClass&lt;T> </p>
  
  <blockquote>
    <p>why do i need the &lt;T> in front of the SomeClass&lt;T> ?
    it seems that if I don't include it there will be an common error
    called Cannot make a static reference to the non-static type T</p>
  </blockquote>
  
  <p>another thing to point out is that I can put many spaces between &lt;T> and SomeClass&lt;T> so it doesn't seem like they need to be together.</p>
  
  <pre><code>public class SomeClass&lt;T&gt; {
  
      public static &lt;T&gt;SomeClass&lt;T&gt; newInstance(Class&lt;T&gt; clazz){
          return new SomeClass&lt;T&gt;(clazz);
      }
  
      private SomeClass(Class&lt;T&gt; clazz){
          System.out.println("hello");
      }
  }
  
  public class Demo {
  
      public static void main(String args[])
      {
          SomeClass&lt;String&gt; instance = SomeClass.newInstance(String.class);
      }
  }
  </code></pre>