According to the definition in the API:
Class.getName(): Returns the "entity" name of the Class object in the form of String;
Class.getSimpleName(): Gets the "underlying class " short name given in the source code.
public class Main { private static final String TAG1 = Main.class.getName(); private static final String TAG2 = Main.class.getSimpleName(); public static void main(String[] args) { System.out.println("getName ----- " + TAG1 + "\n" + "getSimpleName ----- " + TAG2); } }
The resulting picture is as follows:
As shown in the figure above, we can clearly see the difference between them:
getName ---- "entity name" ---- com.se7en.test.Main
getSimpleName ---- "short name of the underlying class" ---- Main