title: Java If statement Array Address
body: <p>I have a code that will give me the coordinates of certain points in an array using user input. What code would I add to make the code output say that the address could not be found if the number in the array is not there? I'm pretty sure I need an else statement but I can't get it to work. Here is the code I have right now.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class LabActivityArray 
  {
      public static void main (String[] args) 
      {
          Scanner scanner = new Scanner (System.in); 
          int rows; 
          int columns;
          int check1,check2;
  
          System.out.println("Enter number of rows: "); 
  
          rows = scanner.nextInt(); 
  
          System.out.println ("Now enter the number of columns: "); 
  
          columns = scanner.nextInt(); 
  
          int[][] array = new int[rows][columns]; 
  
          System.out.println("Enter the number to start the array: ");
  
          int value = scanner.nextInt(); 
          for (int i = 0; i &lt; rows; i++)
          {
              for (int j = 0; j &lt; columns; j++)
              {
                  array[i][j]=value++;
                  System.out.print(array[i][j] + "   " ); 
              }    
              System.out.println();
          }
  
          System.out.println("Please give one integer value to be checked in the array: "); 
          check1 = scanner.nextInt(); 
  
          System.out.println ("Please give a second integer value to be checked in the array: "); 
  
          check2 = scanner.nextInt(); 
  
          for ( int i = 0; i &lt; rows; ++i ) 
          {
              for ( int j = 0; j &lt; columns; ++j ) 
              {
                  if ( array[i][j] == check1 ) 
                  {
                      System.out.print(array[i][j] + " is located at address array[" + i + "," + j + "]");       
                  }
                  if ( array[i][j] == check2 ) 
                  {
                      System.out.print("\n" + array[i][j] + " is located at address array[" + i + "," + j + "]");
                      System.out.println(); 
                  }
              }
          }
      }       
  }
  </code></pre>