import java.lang.reflect.*; public class ReflectInvokeprivaterepeat { public static void main(String... args) { Class[] interfaces = { SuperIwithDefault.class }; Class[] classes = { SuperIwithDefaultChild.class }; for(Class clazz : interfaces) { System.out.println(clazz.toString()); for(Method m : clazz.getDeclaredMethods()) { for(Class clazz1 : classes) { if (!clazz1.isInterface()) { try { Object t = clazz1.newInstance(); m.setAccessible(true); for (int i = 1; i < 20; i++) { m.invoke(t); printInfo(m); } } catch (Exception e) { e.printStackTrace(); } } } } } } private static void printInfo(Method m) { System.out.print("\t"); System.out.print(m.getName()); System.out.printf("\t%x\tdefault: %s\tdeclaring: %s%n", m.getModifiers(), m.isDefault(), m.getDeclaringClass()); System.out.println(); } }