hi there!
I have a file.txt looks like this:


Michael is the member name, while 001 is the ID number.
How can I write a coding to validate that whether user has type in the correct name and ID that is inside the file.txt?
such as, I have a coding that ask user to enter name and ID.
if user type "Michael" and "001", how can I have a coding that can validate user is a member?
please help!
thanks a lot!

You can use an Object of the class Scanner to read in the names from the text file. Store them into an array. Then you can write a search method to search for a name based on what the user inputs. This method could be as simple as checking to see if the String that the user inputs is equal to any of the Strings in the array, using the equals method of the String class.

>Store them into an array
I would like to suggest just a better way. Use a Map instead it would also give you better search capabilities than an array. Instead of searching of all the strings in the array, a Map would offer you search functions.

Store the Id as the key and the name as the value in the Map.