The equals method is used to see if two strings are the same.

    
    String greeting = "Hello";
    String greeting1 = "Hello";

    boolean greetingEquals = greeting.equals(greeting1);

    System.out.println(greetingEquals);
    // true