
当在main方法中新建自身所在类的对象,并调用main方法时,会不断循环调用main方法,直到栈溢出
package com.keywordStudy;
public class mainTest {
    static int value = 33;
    public static void main(String[] args) throws Exception{
        String[] s=new String[]{"fdsafasd","干啥事"};
        //new mainTest().printValue();
        new mainTest().main(s);
    }
    private void printValue(){
        int value = 3;
        System.out.println(this.value);
    }
}结果:









