Java tutorial
//package com.java2s; public class Main { public static boolean isSubclassOf(Class<?> type, Class<?> superClass) { // if (type.getSuperclass() != null) { //// if (type.getSuperclass().equals(superClass)) { //// return true; //// } // // return type.getSuperclass().equals(superClass) || isSubclassOf(type.getSuperclass(), superClass); // } // // return false; return type.getSuperclass() != null && (type.getSuperclass().equals(superClass) || isSubclassOf(type.getSuperclass(), superClass)); } }