• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why does this program start from 60 bottles of Beer and not 99

 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thank you Gamini



me too
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic