Java - IF condition not reading entered String variable value : <pre><code>import java.util.Scanner;

public class Main
{
    public static void main(String[] args) 
    {
        Scanner scan = new Scanner(System.in);
        String play = "y";
        System.out.print("Enter something: ");
        play = scan.next();
        System.out.println(play);
        if (play == "Y" || play == "y")
        {
            System.out.println("If test works!!");
        }
        System.out.println("Did it work???");
    }
}
</code></pre>

<p>I assume this has something to do with when I press enter, it's storing that as well. I tried changing String play to a char, but then I get errors from Scanner saying it can't change a String to a char.</p>
