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 mentionedI have been asked this question in an internship interview.Asked question is from Searching & Modifying a String in portion String Handling of Java

Answer»

The CORRECT choice is (C) value greater than zero

Easy explanation:if (S1 == s2) then 0, if(s1 &GT; s2) > 0, if (s1 &LT; s2) then < 0.



Discussion

No Comment Found

Related InterviewSolutions