title: Problem when searching for a value in a 2D array
body: <p>The repl.it link below takes you to a piece of code which I am currently working on. It is a test for creating a 2D array and searching through it for specific values. I would like to implement this into other code to allow a user to input an email, username and password while signing up and store it in a 2D array as a new account. Then during a login it will search for the password associated with the email entered and compare it to the password which is entered.</p>
  <p>The code in main method is to allow me to create the 2D array which will store three accounts and enter test information. It then prints the 2D array to prove it has been created. The search method is meant to then search through the array for the password associated with an email which I enter. However, there is a problem with the code so that it never finds the email in the array. I have ensured it cycles through the array by making it print the email which it is meant to be comparing the value being searched for and then prints next. It does cycle through this array.</p>
  <p>I believe the problem is when the code compares the entered value to the value the code has found. I do not know how to fix this as the code should find the email and be able to print the password.</p>
  <p>This is likely an easy fix but I need some help.</p>
  <p>Thank you for any responses.</p>
  <p><a href="https://repl.it/@Griff0408/ArrayTestCurrent#Main.java" rel="nofollow noreferrer">https://repl.it/@Griff0408/ArrayTestCurrent#Main.java</a></p>
  <pre class="lang-java prettyprint-override"><code>import java.util.Scanner;
  import java.util.Arrays;
  
  class Main {
  
    static int rowNumber = 3;
    static int colNumber = 3;
    static String[][] Accounts = new String[3][3];
  
    public static void main(String[] args) {
      for (int row=0;row&lt;rowNumber;row++) {
        for (int col=0;col&lt;colNumber;col++){
          Scanner sc = new Scanner(System.in);
          if (col==0) {
            System.out.println(&quot;Enter e-mail:&quot;);
            String yourEmail = sc.nextLine();
            Accounts[row][col] = yourEmail;
          } else if (col==1) {
            System.out.println(&quot;Enter Name:&quot;);
            String yourName = sc.nextLine();
            Accounts[row][col] = yourName;
          } else {
            System.out.println(&quot;Enter password:&quot;);
            String yourPassword = sc.nextLine();
            Accounts[row][col] = yourPassword;
          }
        }
      }
      System.out.println(Arrays.deepToString(Accounts));
      search();
    }
  
    public static void search() {
      Scanner sc = new Scanner(System.in);
      System.out.println(&quot;Enter email:&quot;);
      String searchEmail = sc.nextLine();
      boolean found = false;
      int currentRow = 0;
      while (found==false){
        if (currentRow &lt; rowNumber) {
          String arrayEmail = Accounts[currentRow][0];
          System.out.println(arrayEmail);
          if (arrayEmail == searchEmail){
            found = true;
            System.out.println(&quot;Email: &quot; + Accounts[currentRow][0] + &quot;\nPassword: &quot; + Accounts[currentRow][2]);
          } else {
            currentRow++;
            System.out.println(&quot;next&quot;);
          }
        } else {
          System.out.println(&quot;Email not found.&quot;);
          found = true;
        }
      } 
    }
  }
  
  </code></pre>