wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Why does this program start from 60 bottles of Beer and not 99 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why does this program start from 60 bottles of Beer and not 99" Watch "Why does this program start from 60 bottles of Beer and not 99" New topic
Author

Why does this program start from 60 bottles of Beer and not 99

Varuna Seneviratna
Ranch Hand

Joined: Jan 15, 2007
Posts: 167
Why does this program start from 60 bottles of Beer and not 99



Varuna Seneviratna
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
Because there's a shortage of Beer?

I've compiled and run your program and the output starts from 99..

May be the output is running off your console. Direct the output to a text file (i.e. java BeerSong > beer.txt) and check..
Varuna Seneviratna
Ranch Hand

Joined: Jan 15, 2007
Posts: 167
You are right Gamini when directed to a text file the number of bottles start from 99.I want to know one thing more if a java file is included in a package what is the name that should be given when compiling.I am asking this because the program we were concerned about had a package statement "package chap01", until I removed it I could not run it.
[ September 28, 2008: Message edited by: Varuna Seneviratna ]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38016
    
  22
Do a search for package names. You find threads like this one, where I quoted an earlier thread in my first posting. Those threads explain how to compile a class when it has a package declaration.
Shashank Agarwal
Ranch Hand

Joined: May 20, 2004
Posts: 105
Originally posted by Varuna Seneviratna:
Why does this program start from 60 bottles of Beer and not 99



I think when you're outputting it to console, it overruns the buffer so you only see the only so many lines to see that it started from 60 bottles.
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
Abhi, you are welcome.

Check here for more useful redirections on Windows. This should work for Linux and probabaly other Unix variants too.
Varuna Seneviratna
Ranch Hand

Joined: Jan 15, 2007
Posts: 167
Increasing the Buffer size of the console does not work.I hope what you are asking is to , right click in the upper right coner of the console window go to properties and increase the buffer size well I did that and ran the program

Thank you Gamini
Thanks Campbell For your Reference I enjoyed reading it!

[ September 29, 2008: Message edited by: Varuna Seneviratna ]

[ September 29, 2008: Message edited by: Varuna Seneviratna ]
[ September 29, 2008: Message edited by: Varuna Seneviratna ]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38016
    
  22
Originally posted by Varuna Seneviratna:
Thanks Campbell . . .


You're welcome
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
Thank you Gamini


me too
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

"bob marley",
Welcome to the ranch. You may not be aware of the ranch Naming Policy. Please read it carefully and change your name accordingly (obviously fake names are not allowed). Thank you.


[My Blog]
All roads lead to JavaRanch
 
Consider Paul's rocket mass heater.
 
subject: Why does this program start from 60 bottles of Beer and not 99
 
Similar Threads
Beersong
Head first Beersong
Flaw in Program
Back Again with a program...
How do I turn 2 bottles of beer into 1 bottle of beer?