Can't get if statement to work
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java">How do I compare strings in Java?</a>  </p>
</blockquote>



<pre><code>import java.util.Scanner;

 public class stringComparer {
    public static void main(String[] args) {
        Scanner scan = new Scanner (System.in);
        System.out.println ("Enter 1 word here - ");
        String word1 = scan.next();

    System.out.println ("Enter another word here - ");
    String word2 = scan.next();

    if (word1 == word2) {
        System.out.println("They are the same");
    }
}
}
</code></pre>

<p>I had it working about 10 minutes ago, changed something and it now it doesn't display "They are the same" for some reason? Its really simple yet I can't see where I've gone wrong.</p>

<p>Thanks!</p>
