Error: class is public, should be declared in a file named .java public class.

I send my submission by file and i get this:
Main.java:2: class SPOON is public, should be declared in a file named SPOON.java public class SPOON{ ^ 1 error

When i just put the code in the box i get the same thing…
Can someone tell me how to fix this please?!

3 Likes

For java submissions, your class should be named “Main”. No other name is allowed. Rename the class and try resubmitting it. See Sample Solutions | CodeChef for a sample solution in Java.

7 Likes

Now i’m just getting runtime error NZE2…

You can also submit a non-public class ex:

class Something {

}

instead of

public class Something {


}
3 Likes

Also, do not list the package. I had this error when I did.

That is, omit the line “package SPOON;” if it is there.

1 Like

That means there is an error in your program. For more information see FAQ | CodeChef

2 Likes