package com.beyond.h;import java.lang.reflect.*;public class ReflectTest {
public static void main(String[] args) throws Exception
{
Person p = new Person();
Method m = p.getClass().getMethod("setName");
m.invoke(p, "hdj_myth");
System.out.println(p.getName());
}
}class Person{
private String name;
private int age;

public void setName(String name)
{
this.name = name;
}

public void setAge(int age)
{
this.age = age;
}

public String getName()
{
return this.name;
}

public int getAge()
{
return this.age;
}
}