title: I want to call the column of Account Number and Pin line by line for my Login form. This is like a username and password validity
body: <p>I want to compare when user input - Account Number and Pin. Now, my program get the data from a .txt file and compare it. If, it matches - then gives a message "login successfully", otherwise it will display error. </p>
  
  <p>This is my database:</p>
  
  <blockquote>
    <p>0,admin,Test,123456789,123456</p>
  </blockquote>
  
  <p><strong>This is the data in the .txt file :</strong> </p>
  
  <pre><code>0 = id
  admin = name
  Test = lastName
  123456789 = accountNumber
  123456 = pin
  </code></pre>
  
  <p>and this is my code for reading the file:</p>
  
  <pre><code>package atm;
  
  import java.io.*;
  import java.util.Scanner;
  
  public class Login {
  
      public void verifyLogin(){
          String accountNumber;
          String pin;
          Scanner inputData = new Scanner(System.in);
  
          String fileName = "myDataBase.txt";
          try{
              File file = new File(fileName);
              Scanner readTextFile = new Scanner(file);
  
              System.out.println("\nAccount Number: ");
              accountNumber = inputData.nextLine();
  
              System.out.println("\nPIN: ");
              pin = inputData.nextLine();
  
              String line = null;
              while (readTextFile.hasNextLine()){
                  String[] data = line.split(",");
                  String dataAccountNumber = data[4];
                  String dataPin = data[5];
  
                  if (accountNumber.equals(dataAccountNumber) &amp;&amp; pin.equals(dataPin)){
                      String name = data[2];
                      System.out.println("Welcome" + name);
                      System.out.println("\nLogin Successfully!");
                  }
                  else {
                      System.out.println("Error");
                  }
              }
          }
          catch (Exception e){
          }
      }
  }
  </code></pre>