GradeAnalyser error class


Hello, i’m stuck with this error : error: class GradeAnalyser is public, should be declared in a file named
public class GradeAnalyser {
1 error

Here is my code :

import java.util.ArrayList;

public class GradeAnalyser {
  public GradeAnalyser () {}
  public int getAverage (ArrayList<Integer> grades) {
    if (grades.size() < 0) {
      System.out.println("Grades is empty.");
      return 0; // La mthode doit retourner un entier dans sa dfinition.
    } else {
      int sum = 0;
      for (Integer grade : grades) {
        sum = sum + grade;
      int average = sum / grades.size();
      return average; // La encore, la mthode doit retourner un entier.
	public static void main(String[] args) {
  	ArrayList<Integer> myClassroom = new ArrayList<Integer>();
  	GradeAnalyser myAnalyser = new GradeAnalyser();

First i watched the video but nothing relates to this problem. It doesn’t show any address action. I searched on google but i don’t understand how to specify an address here and why. The file name seems to be good at the top of the workspace. So why specify anything more?

Note that if i erase the public key word on lines 3 & 4, the error message change to this :

Error: Could not find or load main class GradeAnalyzer

Which seems to be another address problem.

Thank you for your time.


the class name should match the filename.

GradeAnalyzer or GradeAnalyser, which should you use? (they are spelled differently (z vs s))


■■■■! I didn’t see the “z”!

Thank you very much!