Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Varuna Seneviratna
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does this program start from 60 bottles of Beer and not 99

 
Gamini Sirisena
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Varuna Seneviratna:
Thanks Campbell . . .


You're welcome
 
Gamini Sirisena
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Gamini


me too
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic