wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Beer Song, can only get it start at 59 and then it counts down Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Beer Song, can only get it start at 59 and then it counts down " Watch "Beer Song, can only get it start at 59 and then it counts down " New topic
Author

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

Edward Draves
Greenhorn

Joined: Sep 28, 2010
Posts: 2
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

Can you post your code ? (don't forget to UseCodeTags when you do so )


[My Blog]
All roads lead to JavaRanch
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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
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."
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11314
    
  16

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'


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Edward Draves
Greenhorn

Joined: Sep 28, 2010
Posts: 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Beer Song, can only get it start at 59 and then it counts down