Create simple login based on txt file
<p>Cannot understand why following code doesn't work properly. Firstly, system getting input from the user. Then system reads all data from <code>.txt</code> file and compare with the user input. But the system never finds similar username and password. </p>

<p>The idea is to create simple login that based on the stored username and password in <code>.txt</code> file. Could someone help?</p>

<pre><code>private static void login() {
    String record = null;
    FileReader in = null;
    try {
        in = new FileReader("adminlogin.txt");
        BufferedReader br = new BufferedReader(in);
        Scanner keyboard = new Scanner(System.in);

        System.out.print("Username: ");
        String user = keyboard.nextLine();

        System.out.print("Password: ");
        String pass = keyboard.nextLine();

        while ((record = br.readLine()) !=null) {
            if (user.equals(record) &amp;&amp; pass.equals(record)) {
                Mainemenu menu = new Mainemenu();
                menu.AdminMenu();
            } else {
                System.out.println("________----Error----________\n press 'Enter' to continue...");
                keyboard.nextLine();
                checkInput();
            }
        }
    } catch (IOException e) {
        e.getCause();
    }
}
</code></pre>