Dynamic Classes in Java

Recently discovered how to create dynamic classes in Java.

Thread.currentThread().getContextClassLoader().loadClass("DynamicClassPath")

And then if you want to invoke a method on it 🙂

Object obj = clazz.newInstance();
Method m = clazz.getMethod("methodName", null);

And then to call it:

m.invoke(obj, null);

About “Mujtaba Hussain”

I have no idea what to write here :(