title: Reading and checking strings from user input
body: <p>I have this code: </p>
  
  <pre><code>import java.util.Scanner;
  
  public class Example {
  public static void main(String[] args) {
  
      Scanner input = new Scanner(System.in);
      String answer = input.nextLine();
  
      if(answer == "yes"){
          System.out.println("Yea I programmed this right!");
      }else{
          System.out.println("Awww :(");
      }
    }
  }
  </code></pre>
  
  <p>But when I run it and type <em>yes</em>, it should be saying </p>
  
  <p><strong>"Yea I programmed this right!"</strong></p>
  
  <p>but it says </p>
  
  <p>"<strong>Awww :(</strong>"</p>