Mega Code Archive

 
Categories / Java Tutorial / Reflection
 

Although the type of o2 is an interface, getSuperclass() returns the objects 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   } }