Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NumberFormatException with Snake
#1
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 -->


Messages In This Thread
NumberFormatException with Snake - by Timkat1994 - 09-16-2013, 03:04 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to export Snake Game as a Runnable JAR file? bedigursimran 0 6,854 11-19-2013, 10:01 PM
Last Post: bedigursimran
  the snake game don't like me. Aaron Rogers118 3 14,128 08-22-2013, 10:10 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)