Comment on Tutorial - compareTo( ) in Java By Mashoud



Comment Added by : Azher

Comment Added at : 2010-01-29 12:23:39

Comment on Tutorial : compareTo( ) in Java By Mashoud
@Adam:
CompareTo returns the difference of the ASCII codes of the first non-matching character. So,

out.print(sOne.compareTo(sTwo)); would display
// (sTwo - sOne)
('a' - 'e') which is -4.
and
out.print(sTwo.compareTo(sOne)) would display
//(sOne - sTwo)
('e' - 'a') which is 4.

Hope this will help you.


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. can anybody hp me how to create a rms database in
View Tutorial          By: contractornimesh at 2011-01-04 00:12:08

2. thanks for your code
could you send me the

View Tutorial          By: nocturne at 2009-01-09 01:57:05

3. My exchange email account is only partially delete
View Tutorial          By: ali at 2010-12-30 02:38:14

4. Can I use my Nokia 6300 as my GSM Modem???? Please
View Tutorial          By: deKi at 2009-03-17 03:54:59

5. Hi Nithya,
yes you can do that see the tut

View Tutorial          By: Ramlak at 2009-03-04 01:20:01

6. Great example - easy to understand!
View Tutorial          By: George at 2009-12-30 03:48:37

7. thank you sir
View Tutorial          By: sivaranjani at 2015-01-30 01:15:40

8. i am not sure of this line(depends on your jvm) ,
View Tutorial          By: vpeddi at 2010-03-20 07:20:19

9. hellow my name is samer, i have a project of final
View Tutorial          By: samer flayha at 2011-08-17 09:37:16

10. I have loaded allthe 5 java files.But how to imple
View Tutorial          By: devi at 2008-04-01 01:02:28