Advertisements
Advertisements
Question
State the purpose and return data type of the following String function:
compareTo()
Answer in Brief
Solution
This function checks the equality of two strings. It examines if a String is larger, smaller, or equal to another String. It returns a value that can be negative, positive, or zero. The return type of this function is integer (int).
shaalaa.com
Is there an error in this question or solution?
Chapter 4: String Handling - EXERCISES [Page 289]