I don't quite understand why the variable needs to be static. I know method1 needs to be static because it's called by main (which is static), and method2 because it's called by method1.
package com.codegym.task.task06.task0616;

/*
Minimum number of statics

*/

public class Solution {
    static public int step;

    public static void main(String[] args) {
        method1();
    }

    public static void method1() {
        method2();
    }

    public static void method2() {
        new Solution().method3();
    }

    public void method3() {
        method4();
    }

    public void method4() {
        step++;
        for (StackTraceElement element : Thread.currentThread().getStackTrace())
            System.out.println(element);
        if (step > 1)
            return;
        main(null);
    }
}