public class Main { public static void main(String[] args) throws Exception { Class c = Class.forName("MyClass");
Method m = c.getDeclaredMethod("say", new Class[] { String.class, String.class });
Object i = c.newInstance();
Object r = m.invoke(i, new Object[] { "Hello","World" });
}
}
class MyClass { public void say(String s1, String s2) {
System.out.println(s1 + " " + s2);
}
}