bottles of beer song won't run.\Playground\:28: error: class, interface, or enum expected } ^ 1 error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

bottles of beer song won't run.\Playground\:28: error: class, interface, or enum expected } ^ 1 error

public class BeerSong { public static void main(String[] args) { int beerNum = 99; String word = "bottles"; while (beerNum>0) { if (beerNum==1) { word="bottle" ; } System.out.Println(beerNum+""+ word +"of beer on the wall"); System.out.Println(beerNum+""+ word +"of beer"); System.out.Println("Take one down"); System.out.Println("Pass it around"); beerNum= beerNum -1; if(beerNum>0) { System.out.Println (beerNum + ""+ word +"of beer on the wall"); } else { System.out.Println ("No more bottles of beer on the wall"); } } } } }

25th Mar 2017, 4:54 AM
Kevin Tsuyoi
Kevin Tsuyoi - avatar
1 Answer
+ 1
you have an extra close bracket at the end. remove 1 of the } .. also, your System.out.println() functions have capital P on print. make them lower case. then your program runs. Works great after those 2 fixes. Only other issue is a few easy to fix spacing issues in your print outs, but that's no big deal.
25th Mar 2017, 6:16 AM
LordHill
LordHill - avatar