Drucken Sie Java -Objekt erbte Klassen erbte Klassen


//package com.java2s;

import static java.lang.System.out;

public class Main {
    public static void printInheritanceTree(Class<?> c) {
        out.format("Inheritance Tree => %n");
        Class<?> ancestor = c.getSuperclass();

        while (ancestor != null) {
            out.format("  %s%n", ancestor.getCanonicalName());
            ancestor = ancestor.getSuperclass();
        }// w w  w .  ja  v  a 2s.co  m
        out.format("%n%n");
    }
}
Cruel Caracal