四、判断类是否是内部类、接口、抽象类

Class<?> type = ...;

//判断是否是匿名内部类
type.isAnonymousClass();

//判断是否是接口
type.isInterface();

//判断是否是抽象类
Modifier.isAbstract(type.getModifiers())

发布了444 篇原创文章 · 获赞 113 · 访问量 40万+

猜你喜欢

转载自blog.csdn.net/panchang199266/article/details/103189796