Computer Science, asked by Shrieya, 1 year ago

What does compareTo() function do in java?Explain with e.g..

Answers

Answered by Anonymous
1
hey mate,

here is your answer

in java

compareTo() function compares the length of the two strings.it returns Boolean value.

#be Brainly

Shrieya: But when I'm trying it on computer it is returning integer value.
Anonymous: oh then it is returning the ascii difference
Anonymous: i like if u compare "abcd" and "abc"
Anonymous: then ascii difference will be returned
Shrieya: Ok
Shrieya: Thanks
Anonymous: welcome
Similar questions