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



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. In the above example..where you make the GC1 objec
View Tutorial          By: prasad at 2014-12-11 11:12:28

2. me too
View Tutorial          By: bellyjoy at 2010-05-07 03:14:14

3. it was very helpful to fix one obscure bug
View Tutorial          By: ander13 at 2009-06-30 04:51:47

4. wow amzing
View Tutorial          By: Anonymous at 2009-04-23 01:44:43

5. I set my eclipse as describe above.
I also

View Tutorial          By: Anonymous at 2012-03-25 02:12:52

6. can any body help me ??????????
i `he get a

View Tutorial          By: gkggt at 2013-02-11 12:09:04

7. Hi Ramlak,
Am getting
Sat Jan 17 13

View Tutorial          By: Shiv Kumar at 2009-01-17 02:01:01

8. This explanation is simple and very useful.
View Tutorial          By: kiran at 2015-02-22 20:47:13

9. Best Example for Inheritance. Thank lot!

View Tutorial          By: Periyasamy C Chennai at 2010-07-09 01:35:30

10. Hi Prathamesh,
Maybe the COM port to which

View Tutorial          By: Ramlak at 2007-03-19 00:46:49