validation in java


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: validation in java

  1. #1
    Join Date
    Sep 2004
    Posts
    2

    validation in java

    I am newbie in java ..so I need some help in validation in java...

    surname = b.readLine();
    if (surname != null && surname != surname1)
    then fileOut.write(surname, 0, surname.length());//write in file
    else System.out.println(" exisiting users or no users");

    for example, I am creating a new customer, so I try to read and write input...when I try to validate for the customer name,i am searching whether if the same person exist...

    how do they know that I am trying to refer my surname 1 as the existing value in text file?Any suggestion or ideas to enlighten me?

  2. #2
    Join Date
    Feb 2004
    Posts
    808
    you cannot compare strings using !=

    you must usethe following:


    !surname.equalsIgnoreCase(surname1)
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center