james1232 wrote:NullPointerException (sometimes abbreviated as NPE) means that your code has a reference value that is null, and the code is trying to use that value as if it was referring to an object. For example, if you had a String b = null and you tried to do "char c = b.charAt(1);" you would get a NPE. Makes sense, right?
Hello everyone, maybe someone can figure this one out.
Here is a sample of the output:
How old are you? 22
Have a coupon? (Y/N)
Exception in thread "main" java.lang.NullPointerException
In this line, myScanner is a variable whose value might be null, but your code uses this variable successfully so it is very likely not null.
reply = myScanner.findInLine(".").charAt(0);
If that line shows 'null' right before the NPE is thrown, now you know the reason why NPE is thrown. You will still need to find out why findInLine is returning null.