I am trying to make a noughts-and-crosses prototype. The section of code I am struggling with is getting an user input, and if the input is y, it should change the gamestate to 0 which restarts the game. However this doesn't happen. Can anyone explain why?
Scanner s = new Scanner(System.in);
                System.out.println("Would you like to play again?");
                if (s.next().toLowerCase() == "y") {
                    System.out.println("Okay");
                    g.gamestate = 0;
                } else {
                    g.gamestate = 4;
                }
 
     
     
    