호출되는 클래스
패키지 ss; 공개 클래스 사용 {public static integer demo (문자열 s) {System.err.println (s+"<<<<<<<<<<<< 성공!"); 정수 ss = 1; 반환 ss; }} 전화를 실행하는 클래스
public class ceshi {public static void main (String [] args) {try {String classname = "ss.use"; 클래스 <?> testClass = class.forname (className); 메소드 sadmethod2 = testclass.getMethod ( "데모", 새 클래스 [] {string.class}); 문자열 result = saddmethod2.invoke (null, new Object [] { "Test Reflection"}). toString (); System.out.println (결과); } catch (예외 e) {e.printstacktrace (); }}위의 기사 Java Reflection은 다른 유형의 정적 메소드 (권장)를 동적으로 호출합니다. 나는 당신이 당신에게 참조를 줄 수 있기를 바랍니다. 그리고 당신이 wulin.com을 더 지원할 수 있기를 바랍니다.