File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stack overflow error on creating new instance

 
Gus Smith
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

Having major problems trying to create a new instance of the class LibraryCard within my other class Library's method. I keep getting stack overflow errors, which from what I know is caused by recursion, but have no idea how to fix this.

Ideally it should create a new library card with a limit of 5 and a cardID of the number in the borrowers variable when the issueCard method is called, but as it stands it just loops forever and doesn't return anything. Any help or nudges in the right direction would be appreciated.
 
Rob Spoor
Sheriff
Pie
Posts: 20393
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gus Smith wrote:

Change the return from issueCard() - which is a call to the same method - to issueCard - the variable you created two lines higher.
 
Gus Smith
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that fixed it.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic