• Post Reply Bookmark Topic Watch Topic
  • New Topic

got a problem : Lyrics of the song 99 Bottles of Beer  RSS feed

 
Minjae Kim
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class BeerSong{
public static void main (String[] args
int x = 99;
String y = "bottles";

if (x > 0) {

if (x == 1) {
y = "bottle";
}
if (x > 0) {
System.out.println("Take one down and pass it around, " + x + " " + y + " of beer on the wall.");
} else {
System.out.println("Take one down and pass it around, no more bottles of beer on the wall");

System.out.println(x + " " + y + " of beer on the wall, " + x + " " + y + " of beer.");
x = x - 1;
System.out.println("Take one down and pass it around, " + x + " " + y + " of beer on the wall.");
System.out.println(" ");
} else {
System.out.println("No more bottles of beer on the wall, no mere bottles of beer.");
System.out.println("Go to the store and buy some more, 99 bottles of beer on the wall.");



well, I got some new problems..
When I compile this one, it doesn't work.
it goes this way...


C:\Documents and Settings\130225\바탕 화면\java>javac BeerSong.java
BeerSong.java:2: error: ')' expected
public static void main (String[] args
^
BeerSong.java:3: error: <identifier> expected
int x = 99;
^
BeerSong.java:6: error: illegal start of type
if (x > 0) {
^
BeerSong.java:6: error: <identifier> expected
if (x > 0) {
^
BeerSong.java:6: error: ';' expected
if (x > 0) {
^
BeerSong.java:6: error: illegal start of type
if (x > 0) {
^
BeerSong.java:6: error: <identifier> expected
if (x > 0) {
^
BeerSong.java:6: error: ';' expected
if (x > 0) {
^
BeerSong.java:8: error: illegal start of type
if (x == 1) {
^
BeerSong.java:8: error: ';' expected
if (x == 1) {
^
BeerSong.java:11: error: illegal start of type
if (x > 0) {
^
BeerSong.java:11: error: <identifier> expected
if (x > 0) {
^
BeerSong.java:11: error: ';' expected
if (x > 0) {
^
BeerSong.java:11: error: illegal start of type
if (x > 0) {
^
BeerSong.java:11: error: <identifier> expected
if (x > 0) {
^
BeerSong.java:11: error: ';' expected
if (x > 0) {
^
BeerSong.java:12: error: illegal start of type
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");
^
BeerSong.java:12: error: ';' expected
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");
^
BeerSong.java:12: error: invalid method declaration; return type required
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");
^
BeerSong.java:12: error: illegal start of type
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");
^
BeerSong.java:12: error: ')' expected
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");
^
BeerSong.java:12: error: ';' expected
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");
^
BeerSong.java:12: error: illegal start of type
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");
^
BeerSong.java:12: error: <identifier> expected
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");
^
BeerSong.java:12: error: ';' expected
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");
^
BeerSong.java:12: error: <identifier> expected
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");
^
BeerSong.java:12: error: illegal start of type
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");

^
BeerSong.java:12: error: <identifier> expected
System.out.println("Take one down and pass it around, " + x + " " + y +
" of beer on the wall.");

^
BeerSong.java:13: error: class, interface, or enum expected
} else {
^
BeerSong.java:16: error: class, interface, or enum expected
System.out.println(x + " " + y + " of beer on the wall, " + x + " " + y +
" of beer.");
^
BeerSong.java:17: error: class, interface, or enum expected
x = x - 1;
^
BeerSong.java:18: error: class, interface, or enum expected
System.out.println("Take one down and pass it around, " + x + " " + y + "
of beer on the wall.");
^
BeerSong.java:19: error: class, interface, or enum expected
System.out.println(" ");
^
BeerSong.java:20: error: class, interface, or enum expected
} else {
^
BeerSong.java:22: error: class, interface, or enum expected
System.out.println("Go to the store and buy some more, 99 bottles of beer
on the wall.");
^
35 errors

C:\Documents and Settings\130225\바탕 화면\java>



I can't find out what is wrong..
I want to get 'Lyrics of the song 99 Bottles of Beer' for answer. and it is on the page http://www.99-bottles-of-beer.net/lyrics.html

please help.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you think the very first error message is trying to tell you? I suspect that most of the others will go away once you fix that one.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
whenever you compile and get erorrs, ignore EVERY error after the first. Fix it, then recompile.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!