In the past, reflection was used to call instance methods, so how do reflection call static methods? See the following example
Class<?> threadClazz = Class.forName("java.lang.Math");Method method = threadClazz.getMethod("abs", long.class);System.out.println(method.invoke(null, -10000l)); Just set the first parameter of the invoke method to null!
The above simple example of Java reflection calling static methods is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.