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-10-13 09:35:10