Q:

Getting Error(NZEC) when trying to compile Java file

I am getting an error(NZEC) while compiling the following programme.
I am unable to figure out the error. Seems like I have done nothing wrong. 
import java.util.Arrays;
import java.util.Scanner;

class mixture{
public static void main(String args[]) {
    Scanner 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]);  
}
}

The error I am getting is :
 Main.java:4: error: class mixture is public, should be declared in a file 
named mixture.java
public class mixture {
   ^
1 error

A:

In Java you always need to use the class name as the file name.
So if your class is called mixture, then you need to save the file under the name mixture.java. (Note that it is also convention in Java to make class names upper case, so you should call it Mixture). 
Obviously, your file is named Main.java (so says your error message). If you want to keep the file name, you need to rename your class to Main instead.
(Note that if you are working online on some web site - you don't state this, but a commenter mentioned something like that - then maybe the website has the convention that you need to call your class Main and you cannot change that...)

