title: how to search an array using user input through a console menu (Java)
body: <p>I'm working on a program that will allow a user to use a console menu to input various things into an array.</p>
  
  <ol>
  <li><p>Input instances of the class student into the array which I have done and works.</p></li>
  <li><p>Create instances of course details which I have also done.</p></li>
  <li><p>And search the array for a particular students details. If a student with this name exists, it will print all of their details that are stored in the array and if not will throw up a message saying something like "Student not on Course".</p></li>
  </ol>
  
  <p>I'm just assuming student names are unique as I only need to store 20 of them. I have created this method so far which doesn't seem to be working. I think I need to use a <code>for</code> loop instead of <code>binarySearch</code> but I'm not quite sure how to do that as no videos or posts seem to show how to use this loop with a <code>String</code> and a <code>Scanner</code>.</p>
  
  <p>This is the method so far:</p>
  
  <pre><code>public static void Search()
  {
      String studentName;
  
      @SuppressWarnings("resource")
      Scanner searchScanner = new Scanner(System.in);
      System.out.println ("Type Student Name to Search");
      studentName = searchScanner.nextLine();
      int FoundName;
      Arrays.sort(Students);
  
      FoundName = Arrays.binarySearch(Students, studentName);
  
      if (FoundName &gt; -1)
      {
          System.out.println("FoundName is" + Students[FoundName]);
      } else
      {
          System.out.println("Student not found");
      }
  }
  </code></pre>
  
  <p>Any help with this would be greatly appreciated, you would be helping a lowly noob out very much :)</p>