package src.getClass;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class GetMethod {
public GetMethod()
{
System.out.println("yusdfsdkfljsflksj");
}
public void doit()
{
}
public void getid()
{
System.out.println("没有的参数的方法的调用!");
}
public String some(String s)
{
System.out.println(s);
return "yuxk";
}
public void getMethod()throws Exception
{
Class clazz = Class.forName("src.getClass.GetMethod");
Constructor construtor = clazz.getConstructor(null);
Object getMethod = construtor.newInstance(null);
Class methodParam[] = new Class[1];
methodParam[0] = String.class;
Method method = clazz.getMethod("some", methodParam);
Object object[] = new Object[1];
object[0] = "wo kao shen qi a ";
Object returno = method.invoke(getMethod, object);
System.out.println((String)returno);
}
static public void main(String args[]) throws Exception
{
new GetMethod().getMethod();
}
}