Solved

string.compareTO(string);

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate example issues from command prompt 10 85
ejb on wildfly 5 63
sql import cannot be resolved jsp 3 117
how to debug htl and js pages 8 80
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

739 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