Java tutorial
//package com.java2s; public class Main { public static boolean isSuperclass(final Class<? extends Object> superclass, final Class<? extends Object> clazz) { if (superclass.equals(clazz)) { return true; } // all classes are superlcass of Object if (clazz.equals(Object.class)) { return false; } return isSuperclass(superclass, clazz.getSuperclass()); } }