This content has been marked as final. Show 4 replies
findInLine() is returning null.
That's probably because "." is a regular expression that matches any character, including, I suspect, null characters. Are you looking for any character or are you looking for a period there? If the latter, try quoting it.
That's my guess without looking at any docs, anyway.
Why don't you look at some docs and try to see why findInLine would return null?
Message was edited by:
in the description for .findInLine(String), it says it behaves exactly like .findInLine(Pattern), whose description is in the next section, and 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."
You get a null pointer exception because you are trying to do something like "null.charAt(0)", i.e. you are trying to call a method on null.