File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes StackOverflowError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "StackOverflowError" Watch "StackOverflowError" New topic
Author

StackOverflowError

meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305


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.


My one regret in life is that I am not someone else.
- Woody Allen
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11169
    
  16

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Thanks
 
 
subject: StackOverflowError
 
Similar Threads
Strange error on running the simplest code there is.
Null Pointer exception when accessing a static instantiated object with in the instance of a class.
Errors in the K&B bonus exam?
how many objects
Null Pointer exception when accessing a static instantiated object with in the instance of