[java] Java Arithmatic Error![solved]
Seriously. I don't know what to say... Java is adding 0's to some of my integer values...
Has this ever happened to anyone before?
Screen-shot below for the people who don't... believe me...
http://i310.photobucket.com/albums/kk420/SmaerdsDreams/Untitled.jpg
I've tried rebooting and it's still mucking things up. Any response would be really good right now!
[Edited by - Cakey on January 22, 2009 8:23:08 PM]
You do
System.out.print(w + " / " + xTileWidth" + " = " + tiles);
And then you do (in the for loop):
System.out.println(tile);
The function System.out.print does not add a new line at the end of the print statement (which is what you call in the first line, so the printing cursor is still on the same line). Then you call System.out.println, which does insert a new line after the print statement. System.out.println(tile); is printing 0, but since you're still on the same line, it looks like "20", rather than a "2" followed by a "0". Try changing the first statement to println, or adding some text at the end of the statement.
This would be a great time for you to use the debugger. If you were to step through your program, one line at a time, you would be able to see it print "2" in the first line, and then later on it would print "0", but it would still be on the same line. This would help you quickly diagnose the problem.
System.out.print(w + " / " + xTileWidth" + " = " + tiles);
And then you do (in the for loop):
System.out.println(tile);
The function System.out.print does not add a new line at the end of the print statement (which is what you call in the first line, so the printing cursor is still on the same line). Then you call System.out.println, which does insert a new line after the print statement. System.out.println(tile); is printing 0, but since you're still on the same line, it looks like "20", rather than a "2" followed by a "0". Try changing the first statement to println, or adding some text at the end of the statement.
This would be a great time for you to use the debugger. If you were to step through your program, one line at a time, you would be able to see it print "2" in the first line, and then later on it would print "0", but it would still be on the same line. This would help you quickly diagnose the problem.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement