0

Any one explain me , what is used to comparTo() string function?

If I declare the string "apple",and another string"APPLE" then the result is 32.. how to come 32 and explain this??

11th Jun 2019, 1:16 PM
VeVin Ganesh
VeVin Ganesh - avatar
2 Answers
+ 6
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.
11th Jun 2019, 8:29 PM
A͢J
A͢J - avatar
0
One more think if i declare two strings names are apple&APPLE then tha result is 32... HOW it is 32 ?? That is my another question
12th Jun 2019, 9:15 AM
VeVin Ganesh
VeVin Ganesh - avatar