package mmmmmm;
public class aaaatest extends test{
public void kkk(int x)
{
System.out.println("pppppppppppp");
}
}
package mmmmmm;
import java.lang.reflect.*;
import java.io.*;
import java.util.*;
public class mmmmmm {
public static void main(String[] args) {
Method mkkk=aaaatest.class.getMethod("kkk",int.class);
mkkk.invoke(null,3);//这里出错,怎么调用aaaatest的kkk方法???
}
}
------解决方案--------------------
改为mkkk.invoke(new aaaatest(),3);即可
------解决方案--------------------
mkkk.invoke(new aaaatest ().,3)