Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple validation

Status
Not open for further replies.

samkal

Technical User
Jun 24, 2008
41
US
Can someone please let me know how to write code for validating user input with existing data.For example if I have all user names stored in an array and user1 enters only user instead of user1, program should pop up error message.
 
If you use an ArrayList instead of an Array, you can use the contains() method:
contains(Object elem)
Returns true if this list contains the specified element.

_________________
Bob Rashkin
 
Thanks! Can you please send me code if it is available.Will appreciate it.
 
Thanks! Now i need to read enumerations from another class ( which is part of jar file). If I import that file and what is the way to read data from that class? Please let me know
 
I don't understand the question (but maybe someone else does; I'm still a bit of a piker with Java).

_________________
Bob Rashkin
 
Sounds like some school assignment, the OP hasn't found google yet. It is all very elementary Java language usage.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top