Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hasNext() and hasNextXXX() Problem

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


K&B book
self test
pg-no.-525
question 15

i have modified it.





1.It complies fine but when it runs ,it just hangs up after displaying

1 2 a 3 45 6 1 2

how to remove this problem


2.if i want
1 2 a 3 45 6 1 2 3 45 6
in the output,then what change should i do in the program ?


 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, try this....
 
Michael Angstadt
Ranch Hand
Posts: 277
Eclipse IDE Java PHP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is in the second loop. If a token is not an integer, it never advances to the next token and gets caught in an infinite loop.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic