fork download
  1. public class BeerSong {
  2.  
  3. public static void main(String[] args) {
  4.  
  5. int beerNum = 99;
  6. String word = "bottles";
  7.  
  8. while (beerNum > 0); {
  9.  
  10. if (beerNum == 1) {
  11. word = "bottle";
  12. }
  13.  
  14. System.out.println(beerNum + "" + word + " of beer on the wall");
  15. System.out.println(beerNum + "" + word + " of beer.");
  16. System.out.println("take on down.");
  17. System.out.println("Pass it around.");
  18. beerNum = beerNum -1;
  19.  
  20. if (beerNum > 0) {
  21. System.out.println(beerNum + "" + word + " of beer on the wall");
  22. } else {
  23. System.out.println("No more bottles of beer on the wall");
  24. }
  25. }
  26. }
  27. }
  28.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class BeerSong is public, should be declared in a file named BeerSong.java
public class BeerSong {
       ^
1 error
stdout
Standard output is empty