package Reflection0; import java.lang.reflect.Method; public class MainReflect { public static void main(String[] args) { Object object = null; Class classObject = null; try { // Load the class dynamically //1st command line argument classObject = Class.forName(args[0]); object = classObject.newInstance(); //Find method by name in //2nd command line argument Method m = classObject.getMethod(args[1], null); m.invoke(object, null); } catch (Exception e) { e.printStackTrace(); } } }