Which method is used to compare two strings?

The compareTo() method compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.

Leave a Reply

Your email address will not be published. Required fields are marked *