Describe the purpose and write the syntax of compareTo() function.
18 Likes
It compares two strings lexicographically. It results in the difference of the ASCII codes of the corresponding characters. Its return type is int.
Syntax:
int <variable-name> = <string-variable>.compareTo(<string-variable2>);
Answered By
10 Likes
Describe the purpose and write the syntax of length() function.
Describe the purpose and write the syntax of replace() function.
Describe the purpose and write the syntax of reverse() function.
Describe the purpose and write the syntax of indexOf() function.