Note that this comparison is case-sensitive . If our names were recorded in lowercase, the statement name. charAt(i) == ‘G’ would never evaluate to true. If the character at index position i is equal to G, our counter increases by 1.
Read moreIs equal case-sensitive?
The equals() method is case-sensitive , meaning that the string “HELLO” is considered to be different from the string “hello”.
Read moreWhat is the difference between equals and equalsIgnoreCase?
The only difference between them is that the equals() methods considers the case while equalsIgnoreCase() methods ignores the case during comparison . For e.g. The equals() method would return false if we compare the strings “TEXT” and “text” however equalsIgnoreCase() would return true.
Read more