public class MyClass { public static String getClassName() { String name = ???; // How can I return "MyClass"? return name; } }
I want to create a static method that returns the name of the class like this, but I don't know what to do.
MyClass.class.getName(); // Returns all class names up to package names.
MyClass.class.getSimpleName(); // Returns only the class name.
You can write whichever you want.
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
881 /usr/bin/google-chrome:symbol lookup error:/usr/bin/google-chrome: undefined symbol:gbm_bo_get_modifier
578 Understanding How to Configure Google API Key
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
1022 In Java servlet, when SHA-256 sends WW-Authenticate header for digest authentication, the client does not return the result.
© 2024 OneMinuteCode. All rights reserved.