Java – get the current class name?

Try,

String className = this.getClass().getSimpleName();

This will work as long as you don’t use it in a static method.

Leave a Comment