Solved

string.compareTO(string);

Posted on 2002-03-28
3
187 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hibernate Not Rolling Back When something fails in a stored procedure 2 51
Requested array size exceeds VM limit 3 84
diffSum example 4 26
varialbe initialization 11 30
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

920 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