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. hey i can write more simple example of this pointe
View Tutorial          By: shruti at 2010-03-03 09:44:58

2. Very Good Example Dude!

Note for re

View Tutorial          By: Erwin at 2009-12-06 20:20:24

3. setting on my nokia 7610 on mtn using operamini 4.
View Tutorial          By: DREAD at 2010-06-21 07:40:13

4. 1==how can we use vb.net web service data in JSF?<
View Tutorial          By: kumaraswamy at 2009-01-06 23:56:53

5. it is really BEST answer of my question.
MR

View Tutorial          By: Ramesh genwa at 2010-09-09 07:15:37

6. To install 32 bit java Communication API you can f
View Tutorial          By: Shailendra at 2013-04-06 14:49:44

7. i want jsp code
View Tutorial          By: KIRTHANA at 2015-07-31 05:29:04

8. This is very good article.
View Tutorial          By: Vipin Joshi at 2008-03-27 13:53:26

9. thanks man really very nice and helpful...........
View Tutorial          By: Bakhtawar khan at 2012-12-05 05:54:18

10. I have a computer science lab final on tuesday (09
View Tutorial          By: kudas at 2009-06-07 10:55:06