Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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));
    }
}