K
K
Koshkasobaka2020-10-29 23:27:20
Java
Koshkasobaka, 2020-10-29 23:27:20

How to print in the console the name of the method in which the exception was thrown?

PrintStackTrace prints the entire call stack. And how to display in the console only the name of the method in which the exception was thrown?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2020-10-29
@Koshkasobaka

exception.getStackTrace()[0].getMethodName()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question