java - Parsing user input - getting integers from strings and exception handling -
my application have text box user edit numbers (hopefully)
i using integer.parseint()
convert string integer, however, there's chance user not pass in numbers throw exception during parseint()
. not sure convention error handling in gwt. work?
int number = -1; try { number = interger.parseint(inputfromuser); } catch (exception e) { // error handling telling user try again }
you on right track. change exception
numberformatexception , should fine.
Comments
Post a Comment