我遇到的错误是“修饰符 'static' 只允许在常量变量声明中使用”?

What I'm getting an error 'modifier 'static' is only allowed in constant variable declarations'?

我的任务是:调用'setGrade'方法将11的值赋给S1的等级变量

密码是:

public class student {
    
    private String name;
    private int age;
    private int grade;
    private double average;
    private boolean disability;
    
    private void printStudentInfo(){
        //Data Encapsulation is methods of the public interface provide access to private data, while hiding implementation. 
        System.out.println("Name: "+name+",Age: "+age+",Grade: "+grade+",Average: "+average +" Disability: "+disability);
    } 
    
    public void setGrade(int newGrade){
        grade=newGrade;
    }
    
    public int getGrade(){
        return grade;
    }

    //this part was given from the question 

    //from here
    public class StudentTester{
       public static void main(String[] args){
           student S1 = new student();
           student S2 = new student();
           //to here

           S1.setGrade(12);
    
       }
    
    }
}

每次我 运行 我的程序都会给我一个错误

modifier 'static' is only allowed in constant variable declarations

测试器 class 应该包含主要方法以及其他 static class 和方法。

public class StudentTester{
    public static void main(String[] args){
        student S1 = new student();
        student S2 = new student();
        S1.setGrade(12);
    }
 
    public static class student {
    
        private String name;
        private int age;
        private int grade;
        private double average;
        private boolean disability;
        
        private void printStudentInfo(){
            //Data Encapsulation is methods of the public interface provide access to private data, while hiding implementation. 
            System.out.println("Name: "+name+",Age: "+age+",Grade: "+grade+",Average: "+average +" Disability: "+disability);
        } 
        
        public void setGrade(int newGrade){
            grade=newGrade;
        }
        
        public int getGrade(){
            return grade;
        }
     }
  }

还要检查,Static Classes In Java