Java program to get the simple name of the class
// Java program to get the simple name of
// the class
public class Main {
public static void main(String[] args) throws ClassNotFoundException {
Class cls = Class.forName("java.lang.String");
System.out.println("The class name associated with cls: " + cls.getName());
System.out.println("The simple class name associated with cls: " + cls.getSimpleName());
}
}
Output
The class name associated with cls1: A
The class name associated with cls2: Main