09-16-2013, 03:04 AM
Hi! I'm following the 8th video of the Snake tutorial and I seem to have missed something and/or completely screwed up. I just started trying to learn Java today and after watching the Tutorials I got started on following the Snake videos. I learn well by example, so these have all been fantastic. I've been at it for hours now, and I can't seem to find what I've done wrong here. The file on the snake page here doesn't have the High Score part added, otherwise I would compare that and mine. Any help would be much appreciated!
Here is the error message:
Exception in thread "Thread-3" java.lang.NumberFormatException: For input string: " 40"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at snakeCanvas.CheckScore(snakeCanvas.java:175)
at snakeCanvas.Move(snakeCanvas.java:142)
at snakeCanvas.run(snakeCanvas.java:267)
at java.lang.Thread.run(Unknown Source)
Here is my progress:
<!-- m --><a class="postlink" href="http://pastebin.com/w7zjJ1fe">http://pastebin.com/w7zjJ1fe</a><!-- m -->
Here is the error message:
Exception in thread "Thread-3" java.lang.NumberFormatException: For input string: " 40"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at snakeCanvas.CheckScore(snakeCanvas.java:175)
at snakeCanvas.Move(snakeCanvas.java:142)
at snakeCanvas.run(snakeCanvas.java:267)
at java.lang.Thread.run(Unknown Source)
Here is my progress:
<!-- m --><a class="postlink" href="http://pastebin.com/w7zjJ1fe">http://pastebin.com/w7zjJ1fe</a><!-- m -->