NZEC Error:

Hi,
I am new to programming. I am stuck with NZEC error.
When i compile it locally it works fine. But in Codechef editor it gives me runtime error (NZEC). After introcing try catch block it gave me this error:

java.util.NoSuchElementException

Someone, please help me to resolve this issue.

import java.util.;
import java.lang.
;
import java.io.*;

class Main {
public static void main(String[] args)throws java.lang.Exception {
Scanner obj = new Scanner(System.in);
try{
int n = obj.nextInt();
int val;
while(n-- > 0){
val = obj.nextInt();
int result = 1;
for(int i=1;i<=val;i++)
result = result * i;
System.out.println(result);
}
}catch(java.lang.Throwable t){
System.out.println(t);
}
}
}

Usually NoSuchElementException comes when you are not giving that much input as your code wants(means if you are giving 5 integers as input but while code executes it requires more than 5 input than this occur) and also when you are giving string as input but your run time input has to be integer.