Getting error every time on CodeChef while compiling the code.

Main.java:5: error: class Sort is public, should be declared in a file named Sort.java
public class Sort {
^
1 error

What does the above error mean and how can I get rid of that?
I am getting that error while compiling the following codes:

import java.util.Scanner;
import java.util.Arrays;


public class Sort {
public static void main( String srgs[]) {
	Scanner x=new Scanner(System.in);
	int n=x.nextInt();
	int a[]=new int[n];
	for(int i=0;i<n;i++) {
		a[i]=x.nextInt();	
	}
	Arrays.sort(a);
	for(int i=0;i<n;i++) {
		System.out.println(a[i]);
	}
}

}


import java.util.Arrays;
import java.util.Scanner;

public class Mixture {
private static Scanner x;

public static void main(String Args[]) {
	x = new Scanner(System.in);
	int n;
	n=x.nextInt();
	int a[]=new int[n];
	for(int i=0;i<n;i++) {
		a[i]=x.nextInt();
	}
	Arrays.sort(a);
	System.out.println(a[0]*a[1]);		
}
}

In Codechef, for Java the name of the class should be “Main” if you are using public access specifier otherwise the compiler will give syntax error message.However you can use any other class name if you are using default access specifie,e.g- class XYZ.
I myself had tough time figuring this out when I started using codechef.