What is the problem with this code(Java)

import java.util.Scanner;

public class Main


public static void main(String[]args){

Scanner kb=new Scanner(System.in);

int n=0;



int a=kb.nextInt();





when I submit it I get a NZEC runtime error
please help!

Don’t Use Public class :stuck_out_tongue: and try now ??

The public class is obviously necessary.
Some guidelines given here: http://www.codechef.com/wiki/sample-solutions#Java
. I was having the same problem. I tried using the InputStreamReader instead of the Scanner and it worked for me. InputStreamReader is also much faster than Scanner for large inputs, however less convenient.
Don’t really know if and why Scanner is a problem, let me know if you find out.

Try using return instead of System.exit(). My guess is that exit value 1 indicates some kind of error is Codechef’s environment.

yup, return fixed it .thanks for the help everyone.