NEZC(non exit zero code)

i have written a code the code is working fine but while submitting it i get a Non exit zero code and due to this i m getting a error. but my program i correct and i m getting the correct output too . can and one help me plz tell me what is this NEZC? and how i can solve it ?

As far as Java is considered NZEC is thrown when Runtime Exception is thrown by your code or a cached Exception that is not handled. Exact cause of the problem can be figured out from the code only. But as the structure of the code here is similar let me give some common reasons for NZEC.

  • Keep caution while taking inputs by parsing. Specially if different types of inputs are involved. Recently there was a question where we had to take two user inputs from a single line. I was doing

    int noOfTestCases = Integer.parseInt(scanner.nextLine());

which is wrong as we are getting whole line as input and then parsing integer out of it. So for next integer I got into trouble ultimately leading to Exceptions.

  • Another very frequent reason for Exception is IndexOutOFBounds. As we are not aware of all possible test cases that may be checked against our solution it is very much possible to get that Exception even though the code works fine for some basic test cases.

NZEC typically means your code did something illegal while it was running that caused an exception to be thrown. It’s difficult if not impossible to tell what is causing this problem without actually seeing your code so as a first step I would recommend posting a link to your solution here so we can inspect it.

NullPointerException and StackOverflow are also some of the other culprits.