public class a { public static void main(String[] args) { Person person = new Person(); //getClass():取得当前对象所属的Class对象 Class<? extends Person> aClass = person.getClass(); //反射获取类加载器 ClassLoader classLoader = Person.class.getClassLoader(); //获取类实现的接口数组 Class<?>[] interfaces = Person.class.getInterfaces(); for (Class<?> anInterface : interfaces) { System.out.println(anInterface); } // System.out.println(interfaces); } } class Person implements Sport { }
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/245618.html