![]() |
| ||
| Error Checking for user input Hello all, is that possible to help me out with Error Checking for user input? I am developing a peg solitaire program and now need a error checking for user input or for input file. Either use try and catch.. or making another method.. can anyone give a me a hint or help me out here please. Regards |
| ||
| Re: Error Checking for user input what kind of error checking? like when the user tries to put a king on a 7? you can use a method to check that and if the user is being a moron, then you can display a joptionpane or you can throw one of your own exceptions which will have to be dealt with. something like InvalidMoveException. |
| ||
| Re: Error Checking for user input For something like that I would say some if else statements would work. Like: if (!card slot is already taken) Of course it would be cool to experiment making your own exception as EB said. |
| ||
| Re: Error Checking for user input Thanks for all replies. I just got it working with try and catch exception, my problem was I use try {}catch (IOException e) {} instead of just use catch (Exception e) {} The input only reads: From <row><coloum> To <row1><coloum1> Exception prevent any invalid input such as "jslkfjsdlkfjlkd". |
| All times are GMT -4. The time now is 11:07 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC