Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

What method do we use to see if one String object is less than another?

OpenStudy (harsha19111999):

We first find the length of the string using length() method and then use the if condition

OpenStudy (anonymous):

Well I guess you have to be more clear about what do you mean with "one String object is less than another"

OpenStudy (anonymous):

I also notice that you didn't mention a language and I just assumed java for some reason. However comparing the lengths is similar in other languages and there are similar strings 'compare' functions as well.

OpenStudy (queelius):

It depends on how the less-than operator is defined -- there is no one "right way." However, typically (or by default), for strings, if A < B, then A comes before B in lexicographic order.

OpenStudy (anonymous):

|dw:1426192482204:dw|

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!