Monday, January 9, 2012

Applet to catch invalid text entered [Java Programming]?

Double.parseDouble(String text) will throw a runtime exception if the value entered cannot be parsed into a double (i.e. it contains letters or other invalid characters). So you could add a try...catch around the parse statement and throw up a message if an exception occurs.

No comments:

Post a Comment