• Post Reply Bookmark Topic Watch Topic
  • New Topic

User input validation  RSS feed

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi guys,

Can somebody help me out why my validation is not working please. I think i have a silly mistake which i am not detecting. Thanks in advance for your replies.
 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What makes you think that something isn't working? It would help if you showed us some evidence of your problem -- like what you expected to happen, what happened instead, what error messages appeared, and so on. Read our FAQ article TellTheDetails for more about that.
 
Sheriff
Posts: 21137
87
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ItDoesntWorkIsUseless. What doesn't it do?

Anyway, I did find one mistake. you should move line 39 to within the try statement (move it down one line). Otherwise the InputMismatchException won't be caught.
 
Ronald Spina
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the main menu there are 8 option for the user to choose. From 1 to 8. I created a validation so that if the user enters anything different for example a char the program will not stop but instead show the user an error message.
My mistake was that line 39 was not inside the try{}.
Now it is working fine. Thnaks guys.
 
Rob Spoor
Sheriff
Posts: 21137
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!