-2

I've just started learning Java, when trying to compile the below source code using "Javac" I am getting the following error:

"C:\Java>javac 99Bottles.java

99Bottles.java:1: error: expected

public class 99Bottles { //open Class "99Bottles"

Can't seem to figure out if this is a syntax error or if i'm missing something? Any advice would be greatly appreciated, thanks

 public class 99Bottles { //open Class "99Bottles"
    public static void main (String[] args) { //Open main method
        int Beernum = 99; //delcate intergar called "Beernum" with value of 99
        String word = "bottles"; //delcare the string "word" with a value of "bottles"

        System.out.println(Beernum + " " + word + "of beer on the walL");  //prints
        System.out.println(Beernum + " " + word + "of beer"); //prints
        System.out.println("you take one down"); //prints
        System.out.println("you pass it around"); //prints

        Beernum = Beernum - 1; //subtract 1 from the value of "Beernum"

        if (Beernum > 0) { //Check if Beernum is greater than 0
                System.out.println(Beernum + " " + "of beer on the wall"); //prints
        } else { //if the if statement is not true run this
                System.out.println("no more bottles of beer on the wall"); //prints
            }        

    }
}
3

1 Answer 1

3

An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter.

Class name is an identifier.

Not the answer you're looking for? Browse other questions tagged or ask your own question.