Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Beer Song, can only get it start at 59 and then it counts down

 
Edward Draves
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Edited to actually have the code tags work.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your code ? (don't forget to UseCodeTags when you do so )
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12087
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'
 
Edward Draves
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic