NumberFormatException while reading input in java

Why am I getting runtime exception while reading characters by using read() method and on next line using readLine() method of buffered reader? What can I do to avoid this? Referring http://www.codechef.com/APRIL14/problems/ADIGIT problem.

For input in Java try using the custom input classes made by @EgorK . These classes are error free and probably the best known for I/O in Java. Take a look at the sample code here.

@vermashubhang I am using custom input classes only, still getting NZEC. My code runs perfectly in my machine and also on ideone.com , here is the solution for the problem http://www.codechef.com/viewsolution/3690073

You can’t share your solution of the ongoing contest as per the rules.

1 Like

I understood the error in my code. I was not beware of this.