Get the class from a string in Java
Description
The following code shows how to get the class from a string.
Example
/*from w w w. j av a 2 s .co m*/
public class Main {
public static void main(String[] argv) throws Exception {
Object object = new String();
try {
Class cls = Class.forName("java.lang.String");
System.out.println(cls);
} catch (ClassNotFoundException e) {
}
}
}
The code above generates the following result.