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 http://www.codechef.com/wiki/sample-solutions#Java for a sample solution in Java.

3 Likes

Now i’m just getting runtime error NZE2…

That means there is an error in your program. For more information see http://www.codechef.com/wiki/faq#Why_do_I_get_a_Runtime_exception

2 Likes

You can also submit a non-public class ex:

class Something {

}

instead of

public class Something {


}

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

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