I have two Strings:
String a=\"org.test.A\";
String b=\"org.test.B\";
I get a class by Reflection
Class aClass = Class.forN
You could start by reading up on dynamic proxies. Proxies do not extend classes, but they do implement interfaces which you can map on your class implementation through the invocation handler.
Generally speaking you want to be able to create new classes (not objects) at runtime. You can use bytecode engineering or java compiler api for that.
As said before I'd recommend to look at CGLIB but there is also javassist which is a class library for editing bytecodes...
Apart from using a JDK dynamic proxy, which works only by interface, you can use CGLIB or javassist for extending classes at runtime.