1String className = n.getClass().getName();
2String name = className.substring(className.lastIndexOf('$')+1,className.length()-4);
3System.out.println(name);
1//Just the name of the class
2myObject.getClass().getSimpleName();
3
4//The name of the class with the package name
5myObject.getClass().getName();