Getting exception in thread “main” java.lang.StackOverflowError

后端 未结 4 1351
臣服心动
臣服心动 2021-01-24 02:09

I am new to Java and OOPs and here is my issue. When I run the below code, I get the

Exception in thread \"main\" java.lang.StackOverflowError.

4条回答
  •  旧时难觅i
    2021-01-24 02:39

    I think you end up creating JavaApplication1 objects all the time which cause the stackOverflow exception. You should remove the line with the comment.

     App2 a2 = new App2();
     JavaApplication1 ja =new JavaApplication1(); //why do you need this?
     public void run(){
    

提交回复
热议问题