接口代碼
public interface ITest {
void test();
}
測(cè)試代碼:
static <T> void validateInterface(Class<T> clazz) {
//判斷clazz是否是接口
if (clazz.isInterface()) {
System.out.printf("clazz is interface");
}
//判斷clazz是否繼承了其他的接口
if (clazz.getInterfaces().length > 0) {
System.out.printf("clazz is not extends other interface");
}
}