What does the Java compiler error message “ expected” mean?

后端 未结 5 909
眼角桃花
眼角桃花 2021-01-19 02:26
class if{
    public static void main (String args[]){
        int x = 9;
        if (x <= 9){
            System.out.println(\"Yay\");
        }else{
                    


        
5条回答
  •  无人及你
    2021-01-19 03:11

    You shouldn't call a class "if". It's a reserved Java keyword (that you're using in your program, BTW).

    Furthermore, by convention, all classes start with an uppercase letter in Java.

提交回复
热议问题