Beer Song, can only get it start at 59 and then it counts down
Edward Draves
Greenhorn
Joined: Sep 28, 2010
Posts: 2
posted
0
The beer song in Head First book seems to be working but it always starts counting down from 59. I've tried
doing a "int beerNum = 99;" and it always just starts at 59. I've tried less than 59 and it responds properly by counting down from that number. I've got 60 stuck in the code below and it still always starts at 59 for the count down. Thanks
Welcome to JavaRanch! As Christophe hints -- ItDoesntWorkIsUseless. We have no way helping you work through your code if we can't see it! :)
W. Joe Smith
Ranch Hand
Joined: Feb 10, 2009
Posts: 710
posted
0
Your command window is deleting them because it only holds so many lines. If you take out all of your system.out.println()'s and just print the number you will see it counts down from 99, just not showing anything past 59.
Also in Java classes always start with a capital letter, so your class should be TestBeerSong, not testBeerSong.
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
you can also change your cmd window to have a larger buffer. If you're on windows, rt-click on the blue bar at the top of it, and select properties.
on the 'layout' tab, change the 'screen buffer size' to something larger than what it is. you can then save it for the current window only, or for 'all windows opened via this shortcut'
Never ascribe to malice that which can be adequately explained by stupidity.