I have a String
which has a name of a class say "Ex"
(no .class
extension). I want to assign it to a Class
variable, like this:
Class cls = (string).class
How can i do that?
Class<?> cls = Class.forName(className);
But your className
should be fully-qualified - i.e. com.mycompany.MyClass