Get super class name


import java.awt.Button;

public class Main {

    public static void main(String[] args) {
        Button o = new Button();
        Class subclass = o.getClass();
        Class superclass = subclass.getSuperclass();
        while (superclass != null) {
            String className = superclass.getName();
            System.out.println(className);
            subclass = superclass;
            superclass = subclass.getSuperclass();
        }
    }
}

Output:


java.awt.Component
java.lang.Object
Home 
  Java Book 
    Runnable examples  

Reflection Class:
  1. Class modifier: public, abstract or final
  2. Class simple name plus package name
  3. Create new instance
  4. Class reflection, all methods, constructors, parameters, interfaces
  5. Get super class name
  6. Get the class By way of .class
  7. Get unqualified class Name
  8. Is Type Compatible
  9. Is Primitive type
  10. Load a class given its name.