The nextInt() call consumed the "21" and returned the value 21, but
it stopped consuming input right there, without swallowing the rest of
the line (that is, without swallowing the end-of-line "sentinel," the
marker produced by ENTER or RETURN or whatever).
Then the findInLine() call looked for a single character *in the
same line*, and didn't find one. Failing to find one, it returned null.
As the Javadoc says,
"If no such pattern is detected in the input up to the next
line separator, then null is returned and the scanner's
position is unchanged."
Finally, the program attempts `null.charAt(0)' -- with unfortunate
but predictable results ...
Consider using next() instead of findInLine(). (Also, consider that
"stream-oriented" Scanner may not be the best tool for "line-oriented"
input -- but maybe that's a topic for another day.)
--
eso...@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM