1. What does the new Solution().method1() do. Create a new object? but what is the name of the newly created object?
2. What does main(null); do here? Where should the program look for the main method?
package com.codegym.task.task06.task0616;
/*
Minimum number of statics
*/
public class Solution {
public static int step;
public static void main(String[] args) {
new Solution().method1();
}
public void method1() {
method2();
}
public 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);
}
}