title: Java generics, call T method as T and not as its superclass
body: <p>I have the following pseudo-code in java:</p>
  
  <pre><code>class MyClassSuper{
      public static final String VALUE = "e";
  }
  
  class MyClassSub extends MyClassSuper{
      public static final String VALUE = "f";
  }
  
  class MyGenericClass&lt;T extends MyClassSuper&gt; {
      public void print(){
          System.out.println(T.VALUE);
      }
  }
  </code></pre>
  
  <p>When I create a new instance of MyGenericClass with MyClassSub as its type I'm expecting the print method to print "f", but it prints "e" instead. Is it possible to have MyGenericClass treat T as the actual type that it is while keeping the super class that T extends currently ?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Actual code (abbreviated):</p>
  
  <pre><code>public class Bean implements Serializable {
  
      public static final String FILE_EXT = "";
      private static final long serialVersionUID = 1L;
  
  }
  
  public class UserBean extends Bean{
  
      public static final String FILE_EXT = "u";
      private static final long serialVersionUID = 1L;
  
      private String name;
  
      public UserBean(String name){
          this.name = name;
      }
  }
  
  public class BeanPersistence&lt;T extends Bean&gt; implements IBeanPersistence&lt;T&gt; {
  
      public void printExtension(){
          System.out.println(T.FILE_EXT);
      }
  
  }
  </code></pre>
  
  <p>That is the code I'm trying to write. Basicly I want the BeanPersistence class to know what extension to use for the file it is writing, based on the type of Bean it was initialized with. From the comments I gather this is the wrong way of doing this, what would be the appropriate way ? (Obviously the printExtension method is just there to test)</p>