Solved

string.compareTO(string);

Posted on 2002-03-28
3
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

632 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