I wrote this little piece of code in JavaFX:
tfb.setOnAction(new EventHandler<ActionEvent>() {
    @Override public void handle (ActionEvent e) {
        if(tf1.getText() == "test") {
            System.out.println("correct");
        } else {
            System.out.println("wrong");
        }
    }
});
When I enter "test" in the text field, I always get a "wrong" printed by my code, not a "correct" as it should be. I checked several times whether I spelled "test" correctly, and I also tried to put "test" in quotation marks (double: " and single: '), none of this helped.
I already tried to print out the content of the text field (with System.out.Println(tf1.getText())), and I got what I wrote in the text field on the console, so the action listener and tf1.getText() work for sure.
What can be wrong with my code?
 
    