I have the correct output(I think)
Not verifying
Any idea?
package com.codegym.task.task09.task0902;
/*
Stack trace revisited
*/
public class Solution {
public static void main(String[] args) throws Exception {
method1();
//System.out.println(Thread.currentThread().getStackTrace());
}
public static void method1() {
method2();
System.out.println(Thread.currentThread().getStackTrace()[2].getMethodName());
}
public static void method2() {
method3();
System.out.println(Thread.currentThread().getStackTrace()[2].getMethodName());
}
public static void method3() {
method4();
System.out.println(Thread.currentThread().getStackTrace()[2].getMethodName());
}
public static void method4() {
method5();
System.out.println(Thread.currentThread().getStackTrace()[2].getMethodName());
}
public static void method5() {
//write your code here
System.out.println(Thread.currentThread().getStackTrace()[2].getMethodName());
}
}