Computer Science, asked by aditimsant1212, 1 year ago

What does the compareTo do in Java?

Answers

Answered by PiyushSinghRajput1
1

The Java String compareTo() method is used for comparing two strings lexicographically. Each character of both the strings is converted into a Unicode value for comparison. If both the strings are equal then this method returns 0 else it returns positive or negative value.

Similar questions