With error { How old are you ? 21 Do you have a coupon ? (Y/N) Exception in thread "main" java.lang.NullPointerException at NicePrice.main(NicePrice.java:18)
No i didnt write it my self its a pratctise code in a book_for dummies_java_programming.pdf
Copied the code exactly how it was and it didnt run properly made an other programm which uses "char " not only "int" and the problem was the same ....
i have downloaded the java api doc etc from an old link ... dunno m8 if my win7 have the problem am not pro on this stuff plz whenever you have time send me a quick link for java doc .zip /.rar i might have problem in the doc files :/
THANKS A LOT cant find them googled them everywere
Ah, OK. The example program is bad in very many ways (even if you exclude the fact that it doesn't work).
The simplest way to get this code to work is to replace
.findInLine(".")
with
.next()
(The code gives the same error both in Windows and Mac. The error is down to the author not using the Scanner object properly to process keyboard input.)