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:
Solution # main ()
;Solution # method1 ()
;java.lang.Thread # getStackTrace ()
.
P.S. pointed in direct order for readability, on the stack it is in reverse order.