Sail E0 Webinar
Question

What is the value returned by function compareTo() if the invoking string is less than the 

string compared?


Options:
A .  zero
B .  value less than zero
C .  value greater than zero
D .  None of the mentioned
Answer: Option B

compareTo() function returns zero when both the strings are equal, it returns a value less than 

zero if the invoking string is less than the other string being compared and value greater than 

zero when invoking string is greater than the string compared to.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers