title: Getting a string from a scanner when a number is entered
body: <p>I am trying to write a program that ask a user for 2 numbers and then ask the user to pick a command from a menu by entering the correspond number to the command. 
  I can write the program if i take the input as an Int but cannot figure it out for a string, also it has to be a string.
  I am having problems when it enters the while loop to validate the user input it does not stop when the statement is false it will stay in the loop I can not figure out what i am doing wrong.
  Here is the code i have.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import java.util.Scanner;
  public class ab {
    public static void main(String[] args) {
      System.out.println("-------------------------------------");
      Scanner stdIn = new Scanner(System.in);
      double L;
      System.out.print("Enter the left operand: ");
      L = stdIn.nextDouble();
      double R;
      System.out.print("Enter the right operand: ");
      R = stdIn.nextDouble();
      System.out.println("-------------------------------------");
      System.out.println("1 -&gt; Multiplication");
      System.out.println("2 -&gt; Division");
      System.out.println("3 -&gt; Addition");
      System.out.println("4 -&gt; Subraction");
      System.out.println("-------------------------------------");
      String input;
      System.out.print("Choose one of the following commands by enterning the corresponding number: ");
      input = stdIn.next();
      System.out.println();
      while (!input.equals(1) &amp;&amp; !input.equals(2) &amp;&amp; !input.equals(3) &amp;&amp; !input.equals(4)) {
        System.out.print("Invalid entry, please type a valid number (1, 2, 3 or 4): ");
        input = stdIn.next();
        System.out.println();
        if (input.equals(1)) {
          System.out.print(L + " * " + R + " = " + (L * R));
        } else if (input.equals(2)) {
          System.out.print(L + " / " + R + " = " + (L / R));
        } else if (input.equals(3)) {
          System.out.print(L + " + " + R + " = " + (L + R));
        } else {
          System.out.print(L + " - " + R + " = " + (L - R));
        }
      }
      stdIn.close();
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Any help would be much appreciated.
  Thank you in advanced.</p>