1.

What is the value returned by function compareTo() if the invoking string is greater than the string compared?(a) zero(b) value less than zero(c) value greater than zero(d) none of the mentioned

Answer» The correct choice is (c) value greater than zero

Easy explanation:  if (s1 == s2) then 0, if(s1 > s2) > 0, if (s1 < s2) then < 0.


Discussion

No Comment Found

Related InterviewSolutions