File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Enums in Java needed Clarity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Enums in Java needed Clarity" Watch "Enums in Java needed Clarity" New topic
Author

Enums in Java needed Clarity

Chand Prem
Greenhorn

Joined: Nov 26, 2012
Posts: 1
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

Joined: Oct 13, 2005
Posts: 36453
    
  15
Welcome to the Ranch

Why do you think enums are any good for validating inputs?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10908
    
  12

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enums in Java needed Clarity
 
Similar Threads
Significant difference between if:loop and loop:if?
What features C++ has, but Java is missing
alternative for interface
What is Enums?
regarding enums