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:
I tried looking up findInLine and I couldn't find anything about null. Maybe it's because I'm very new at programming that I can't find it in the doc file. I
What does it mean by exception? Also, what does NullPointer mean?
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.
What does it mean by exception? Also, what doeshttp://java.sun.com/j2se/1.5.0/docs/api/java/lang/NullPointerException.html