Click to See Complete Forum and Search --> : I hate validation


JonnyB
02-21-2006, 02:35 PM
I still can't get a simple way of validating letters. If the user of the program is meant to type a number a types a letter by accident, how do you get it to reaconised the error and loop the input? Without using catch or try statements. can it be done with a do, while loop?

eg
please input your mark: a //user makes the mistake

Error, please input a number

please input your mark: //program loops to the orginal request

Khalid Ali
02-21-2006, 04:51 PM
the best way to validate numerical values is to use NumberFormatException..and thats it....:-)

JonnyB
02-22-2006, 01:16 PM
Im only new at this, so how does that work??