title: Switch statement within Do-While loop doesn't exit
body: <p>The code doesn't exit after I type "stop" - for some reason. Why?
  Step-by-step debugging shows that after I enter "stop" it's value consists of exactly 's','t','o','p' without any line breaks, etc. - however, the code still goesn't exit. Could anyone tell why, please?</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Application {
  public static void main(String[] args) {
      Scanner input = new Scanner(System.in);
  
      // asking username
      System.out.print("Username: ");
      String username = input.nextLine();
  
      String inpText;
      do {
          System.out.print(username + "$: ");
          inpText = input.nextLine();
          System.out.print("\n");
          // analyzing
          switch (inpText) {
          case "start":
              System.out.println("&gt; Machine started!");
              break;
          case "stop":
              System.out.println("&gt; Stopped!");
              break;
          default:
              System.out.println("&gt; Command not recognized");
          }
      } while (inpText != "stop");
  
      System.out.println("Bye!..");
  }
  }
  </code></pre>