Java Reflection class get parent class

Description

Java Reflection class get parent class

public class Main {
   public static void main(String args[]) throws Exception {
      Class c = Class.forName("javax.swing.JLabel");
      System.out.println(c.getSuperclass());
      //w w w. ja v  a  2  s .  co  m
      c = Class.forName("javax.swing.JComponent");
      System.out.println(c.getSuperclass());

      c = Class.forName("javax.swing.JFrame");
      System.out.println(c.getSuperclass());
      

   }
}



PreviousNext

Related