• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enums in Java needed Clarity

 
Chand Prem
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I want to know how to validate users input (for ex Month name) using enums in Java. Can some one provide a examples or a link explaining it.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Why do you think enums are any good for validating inputs?
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12101
30
Chrome Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is a common mistake many people make. They ask a question along the lines of "How do I use X to do Y?".

The better question would be "What is the correct way to do Y?". By already deciding what technology to use before you think about what the problem you are trying to solve is, you box yourself into a corner.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic