Although the type of o2 is an interface, getSuperclass() returns the object's superclass : SuperClass « Reflection « Java






Although the type of o2 is an interface, getSuperclass() returns the object's superclass

  

public class Main {
  public static void main(String[] argv) throws Exception {

    Runnable o2 = new Runnable() {
      public void run() {
      }
    };
    Class sup = o2.getClass().getSuperclass(); // java.lang.Object
  }
}

   
    
  








Related examples in the same category

1.Getting the Superclass of an Object
2.Superclass of Object is null
3.The superclass of primitive types is always null
4.Retrieving other information through the class pointer
5.Return true if class a is either equivalent to class b, or if class a is a subclass of class b, i.e. if a either "extends" or "implements" b.
6.Allows the user to reflectively inspect an object hierarchy