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

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -