I've been trying to make a little program that reads what the user inputs, and if it is correct, the program prints out (user input) + " is a match", and if not, then it says NO MATCH.
The issue that I am having is that even if I input the correct word (cat), it still prints NO MATCH in the console. Would appreciate any help! Thanks :)
Here's the code for what I have:
import java.util.Scanner;
public class StringTester {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        String inData;
        System.out.println("Enter a word:");
        inData = stdin.nextLine();
        String response = inData;
        if (response == "cat") {
            System.out.println(response + " is a MATCH");
        } else {
            System.out.println("NO MATCH");
        }
        System.out.println("End of program");
    }
}
 
    