Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;

import java.util.List;

public class Main {

    public static List<Class<?>> getSuperClasss(Class<?> sourceClass, boolean isAddCurrentClass) {
        List<Class<?>> classList = new ArrayList<Class<?>>();
        Class<?> classs;
        if (isAddCurrentClass) {
            classs = sourceClass;
        } else {
            classs = sourceClass.getSuperclass();
        }
        while (classs != null) {
            classList.add(classs);
            classs = classs.getSuperclass();
        }
        return classList;
    }
}