How to fix this? Getting the correct answer when I do custom input but showing error when I try to submit
It is better to use try-catch blocks in exception handling to avoid this error.
Can you please elaborate further? Like how to take the input if I want to?
If you want to take input you can follow the below syntax by using try-catch blocks.
`import java. util.*;
public class Main {
public static void main(String[] args) {
try
{
Scanner sc =new Scanner(System.in);
// You can write your code below without getting the NZEC error by using try-catch blocks(Exception Handling).
}
catch (Exception e)
{
return;
}
}
}`