getting only name of the class Class.getName()
The below both ways works fine.
System.out.println("The Class Name is: " + this.getClass().getName());
System.out.println("The simple Class Name is: " + this.getClass().getSimpleName());
Output as below:
The Class Name is: package.Student
The simple Class Name is: Student
Class.getSimpleName()
or programmaticaly
String s = String.class.getName();
s = s.substring(s.lastIndexOf('.') + 1);