This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes inner classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "inner classes" Watch "inner classes" New topic
Author

inner classes

pallavi utukuri
Ranch Hand

Joined: Feb 10, 2004
Posts: 182
can any1 explain y does the below code throw StackOverflowError???

where as if line 1 is removed everything goes well!

Code tags and a few spacers added - Barry
[ April 11, 2004: Message edited by: Barry Gaunt ]

Thanks,<br />Pallavi
Raj Chila
Ranch Hand

Joined: Mar 18, 2004
Posts: 128

isnt it that you are initializing the inner class within the Inner class inn1?
because this is a variable which is initialized every time you create a new instance of inn1...it will be a cycle that never ends and hence the runtime exception...
comment the line inn1 z= new inn1(); and uncomment the //1 line and it will work fine
[ April 11, 2004: Message edited by: RajaniKanth Bhargava ]
pallavi utukuri
Ranch Hand

Joined: Feb 10, 2004
Posts: 182
ys ur logic makes sense thannks
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: inner classes
 
It's not a secret anymore!