The java.lang String equals method is used to compare two strings for equality. It returns true if the two strings are equal and false otherwise. The method is case-sensitive, meaning it considers uppercase and lowercase letters as distinct.
In this example, the two strings str1 and str2 are not equal because of the difference in case, and the method returns false.
The java.lang String class is part of the Java standard library, which is included in the default Java package. Therefore, no additional package library is required to use the String equals method.
Java String.equals - 30 examples found. These are the top rated real world Java examples of java.lang.String.equals extracted from open source projects. You can rate examples to help us improve the quality of examples.