Question: How would I implement a login/register program in Java using a text file? Program will read from the text file to see if user exists

How would I implement a login/register program in Java using a text file? Program will read from the text file to see if user exists and can successfully login, if not, it will add a user to the text file.

How would I implement a login/register program in Java using a text

Text file i'm trying to use:

file? Program will read from the text file to see if user

public static boolean Login (User user, String username, String password) { private void createUserList File file = new File("UserList.txt"); FileReader fr; try { fr = new FileReader (file); BufferedReader br = new BufferedReader (fr); String line; User user = null; Password pass; while ((line = br.readLine()) != null) { String[] split line.split("\\s*,\\s*"); String tempUser split[0]; String temp Pass = split[i]; boolean login = false; if (user.equals((splitroll login = true; break; } } } catch (FileNotFoundException ex) { Logger.getLogger (Login.class.getName()).log(Level. SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Login.class.getName()).log(Level. SEVERE, null, ex); } return false; } UserList - Notepad File Edit Format View Help e User123, Password123 -. s Test13, Pass321 it Testing123, password it Username212, password1| it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!