title: How to match user input with arraylist
body: <pre><code>package BankingSystem;
  
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Scanner;
  
  public class Bank {
  
    public static void main(String [] args){
  
        List&lt;String&gt; AccountList = new ArrayList&lt;String&gt;(); 
        AccountList.add("45678690");
        Scanner AccountInput = new Scanner(System.in);
        System.out.println("Hi whats your pin code?");
        AccountInput.nextLine();
  
        for  (int counter = 0; counter &lt; AccountList.size(); counter++){  
            if (AccountInput.equals(AccountList.get(counter))){ //If Input = ArrayList number then display "hi"
                System.out.println("Hi");
  
            }
            else { //If not = to ArrayList then display "Incorrect"
                System.out.println("Incorrect");
  
            }
            }
        }
        }
  </code></pre>
  
  <p>Hi, in here I am trying to match the userInput to arrayList, if its correct then display "hi" if not display "Incorrect", for the incorrect part do I to use exception handling? and how can I get it to match the ArrayList number - 45678690?</p>