Solved

string.compareTO(string);

Posted on 2002-03-28
3
198 Views
Last Modified: 2012-05-04
what does this function returns ?
i tried and it returns numbers
0 if equals ?
how about the others ?
0
Comment
Question by:prinx
3 Comments
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 50 total points
ID: 6904576
Return value of a.compareTo(b), where a and b are both of type String:

If a is equal to b, then 0.
If a is lexicographically less than b, then a value less than 0.
If a is lexicographically greater than b, then a value greater than 0.

For more info, please read:
http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html#compareTo(java.lang.String)
0
 

Author Comment

by:prinx
ID: 6904605
yea i read that, sorry for not being clear but what i mean it the return value what does it means for eg it returns 25 for one time..why 25 ?
0
 
LVL 9

Expert Comment

by:Ovi
ID: 6904612
Probably the algorithm of the method use some control values (distances) which are returned.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now