When the program throws a Throwable instance, instead of simply printing the stack trace on the console or logging it, you can obtain an array of StackTraceElement objects by calling the getStackTrace method on that instance. One of them calls the other, hence both become part of the same call stack: public StackTraceElement methodA() Accessing Stack Traces with the Throwable Class The following are two methods of the StackElementExample class. This invocation returns an array of StackTraceElement, from which details about stack frames of the thread can be extracted. You can obtain a stack trace from a thread – by calling the getStackTrace method on that Thread instance. } Accessing Stack Traces with the Thread Class The following test class will be filled with methods calling those in the StackElementExample class: package This class will contain methods illustrating a stack trace.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |