Hi, I am doing input from the keyboard and want to safeguard against accidental pressing of the <enter> key without any value having been entered first. I have some simple code here (for demo purposes), and tried to check when it crashes, but don't see a pattern yet (or rather, I see it, but I don't understand it).
This, for example, does not crash, even if I enter nothing before pressing <enter>:
On the other hand, this will give a NumberFormatException:
In other words (and as indicated by the name of the exception), the problem occurs when I try to convert to a number. An empty line is not null then? I doesn't seem to work with using double quotation marks either (empty string).I'm not sure how I should be checking for empty input in the conditional statement...
Thanks for any helpful comments! Flo
[ January 25, 2005: Message edited by: Flo Powers ] [ January 25, 2005: Message edited by: Flo Powers ]