I am going to check if a JLabel is the same as a name of a tv show.
I have the code
public int lastEp() {
    if(name.getText() == "Dexter") {
        switch (season) {
        case 1:
            return 12;
        case 2:
            return 12;
        // etc.
        }
    }
    return -1;
}
I have checked in console what i get from name.getText() and the console prints "Dexter".
Still my if statement wont return true.
System.out.println(name.getText() == "Dexter") gives false, while System.out.println(name.getText() + " " + "Dexter") gives "Dexter Dexter".
What is happening?
Also bonus question, if anyone know what i should return instead of -1 if no other option fits, if there is a good standard to follow.
 
    