Question: How would I create 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 create 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 at the login screen. If not, they would need to create a user through another GUI then once user creates an account it will add the user to the text file. Below is what I have so far,
Code:

Login screen

Text file example:

// method that check if username and password exist in the file public static boolean login(String user, String pass) { // creating object of file class File file = new File("UserList.txt"); FileReader fr; // variable to store login result boolean Login = false; try fr = new FileReader (file); BufferedReader br = new BufferedReader (fr); String line; // reading from file and checks if it matches with file while ((line br.readLine() != null) { String[] split = line.split(", "); String username; String password; split[0]; password = split[1]; } username = } return Login; } = true; public static ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
