In this example we will find the name of the class name.
Description of the method used in the example:
getStackTrace: Provides programmatic access to the stack trace information printed by printStackTrace(). It returns array of StackTraceElement objects.
getClassName: It returns String type fully qualified name of the class containing the execution point represented by this stack trace element.
Here is the code of GetCollingClass.java
Output will be displayed as:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.