Reading data into array from file and perform the searching
Hello, I am a new java programmer.
I have a question about how to reading data into array from file and perform the searching
in the text file, I have:
I need to put this text file into array first
and then when I input the keyword, e.g. "Tommy"
it can be print out "Correct"
or if I input "Daisy"
it can be print out "Wrong"
can anyone help me to solve the problem?
public static void searchdata()
//create file object
File file = new File("db.txt");
//create FileInputStream object
FileInputStream fin = new FileInputStream(file);
byte fileContent = new byte[(int)file.length()];
String strFileContent = new String(fileContent);
//I'll Stop it here...
System.out.println("File not found" + e);
System.out.println("Exception while reading the file " + ioe);