Skip to content

Instantly share code, notes, and snippets.

@johnjohndoe
Created June 3, 2011 23:54
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