Home java StackTrace Java

StackTrace Java




I can’t understand why the length is 3? how is it even calculated? Is it the length of the array or the length of the method? What is 3, is it some kind of ordinal or number of elements / lines or something else?

Answer 1, authority 100%

The point is that the call to the getStackTrace () method also ends up in the stack trace, which ultimately looks like this:

  1. Solution # main () ;
  2. Solution # method1 () ;
  3. java.lang.Thread # getStackTrace () .

P.S. pointed in direct order for readability, on the stack it is in reverse order.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions