"Here’s a small task about displaying the stack trace."
Returning a stack trace
There are five methods that call each other. You need to make each method return its stack trace.
Stack trace revisited
There are five methods that call each other. You need to make each method return the name of the method that called it. Use the stack trace to obtain this information.
Who called me?
There are five methods that call each other. You need the method to return the line number of the code from which it was called. Use the element.getLineNumber() method.
Logging stack traces
Implement the log method so that it displays the name of the file and method in which it is called, as well as the passed message. Use a colon and space to separate the file name, method name, and message. Example output: Solution.java: main: In method Getting the file name from a StackTraceElement
Stack trace with 10 calls
Write the code to get a stack that is 10 calls deep. Don't change the main method.
The method returns a result — the depth of its stack trace
Implement a method that returns the stack trace depth, i.e. the number of methods in the stack trace. In the method, the same number needs to be displayed on the screen.