Java 8 : Invoke Interface's static method using reflection -
i want invoke static method of java 8 interface using reflection api.
public interface timeclient { static void teststatic() { system.out.println("in static"); } }
i able invoke default method of interface unable invoke static method.
i see no problems:
timeclient.class.getdeclaredmethod("teststatic").invoke(null);
works without problems , prints "in static". getmethod
works expected:
timeclient.class.getmethod("teststatic").invoke(null);
Comments
Post a Comment