Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Java introspection for class name and function name
// Print name of the current function.
new Throwable().fillInStackTrace().getStackTrace()[0].getMethodName();
// Print simple class name.
getClass().getSimpleName();
// Print full class name.
getClass().getName();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment