public class Runme { public static void main(String[] args) { Runme rm = new Runme(); rm.getSuperclazz(rm.getClass()); } private Class getSuperclazz(Class clazz) { Class superC = clazz.getSuperclass(); System.out.println("clazz..name: " + clazz.getName()); if (superC == null) { return superC; }else{ return getSuperclazz(superC); } } }
时间: 2024-12-19 07:16:23