Login program with java with error

Beperaige

New Member
I'm new to java and I am making a login program (based on text file processing) as part of my Java assignment so far I have written this code but it only checks the first line in the text file. I have also tried to add a for loop but it didn't work either.Could you please help me fix this problem.(username and password are separated by a tab character in the file that's why I used this (user+"\t"+pass))Already tried the web, I didn't find any good tutorial. \[code\] FileInputStream fstream = new FileInputStream("file.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { if ((user+"\t"+pass).equals(strLine)) {System.out.println ("Sucess");} }\[/code\]the text file is so \[code\] x y x z x t\[/code\]so when you enter x and y the program says Success but for x and z or t there is no result!
 
Top