Compare 01 Flashcards

1
Q

Can you explain the purpose of the compareTo() method?

A

The java string compareTo() method compares the given string with current string lexicographically.

It returns positive number, negative number or 0. It compares strings on the basis of Unicode value of each character in the strings.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does compareTo() method return?

A

It returns positive number, negative number or 0. It compares strings on the basis of Unicode value of each character in the strings.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly