Describe the purpose of compareTo(). Write down the return datatype pf the function.
Answers
Answered by
1
Answer:
Describe the purpose of compareTo?
The compareTo() method compares two strings lexicographically. ... The method returns 0 if the string is equal to the other string. A value less than 0 is returned if the string is less than the other string (less characters) and a value greater than 0 if the string is greater than the other string (more characters).
Write down the return datatype pf the function?
See the picture dear...
Attachments:
Answered by
0
The method compairTo( ) is used to lexicographically check two Strings where the Unicode differs.
The return type of the method is int.
Similar questions