Home > Back-end >  compare
compare

Time:09-24

The compare () method returns the must be 1 0-1? Pay attention to is the compare not compareTo

CodePudding user response:

Not necessarily, the return value is greater than zero, equal to zero, and less than zero, the corresponding comparison results for large, such as, small, usually because of greater than zero or less than zero number is right, so just use 1 and 1 is more convenient, later you contact, you will see some direct return the result of the subtraction, this kind of situation will appear greater than 0 or less than zero, such as return the length of a string of 1-2 of the length of the string

CodePudding user response:

See the document, will be subject to the instructions on the document,