打印继承树
//from N o w J a v a . c o m - 时代Java //package com.nowjava; 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();//来自 n o w j a v a . c o m } out.format("%n%n"); } }