• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

StackOverflowError

 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Exception in thread "main" java.lang.StackOverflowError
at Test.<init>(Test.java:3)
at Test.<init>(Test.java:3)
at Test.<init>(Test.java:3)
at Test.<init>(Test.java:3)
at Test.<init>(Test.java:3)
at Test.<init>(Test.java:3)
at Test.<init>(Test.java:3)
at Test.<init>(Test.java:3)

I don't understand reason.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12084
29
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what happens when you do this:

Test obj=new Test();

you make a Test object. What does it hold? Two Test objects. Each of those has to hold two Test objects, each of which have to hold two Test objects...

and eventually you run out of stack space.
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic