. , , - :
public class ReflectionExample {
private static class A {
public void foo() {
System.out.println("fooing A now");
}
}
public static void main(String[] args) throws SecurityException, NoSuchMethodException, IllegalArgumentException,
IllegalAccessException, InvocationTargetException {
Method method = A.class.getMethod("foo");
method.invoke(new A());
}
}
Method.invoke ( ).
EDIT: , , , . , , , String . .
- . , , , - . , . IDE (, Eclipse) , - , .