In C# we have Type.FullName and Type.Name for getting the name of a type (class in this case) with or without the namespace (package in java-world)
Type.FullName
Type.Name
If using a StackTraceElement, use:
String fullClassName = stackTraceElement.getClassName(); String simpleClassName = fullClassName.substring(fullClassName.lastIndexOf('.') + 1); System.out.println(simpleClassName);