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. thanks i am fresher to j2me i understand the conce
View Tutorial          By: anusha at 2010-04-20 00:32:10

2. Hi, I implemented those project in my NetBeans, cr
View Tutorial          By: Leshqo at 2008-11-14 07:09:13

3. Hi please help me out..

i am gettin

View Tutorial          By: sasivarnan at 2011-04-22 14:15:40

4. can u access by a tutorial by using java script
View Tutorial          By: Benjtaz at 2011-07-11 06:22:16

5. Your Crystal report viewer showing all the records
View Tutorial          By: Neel at 2013-06-09 15:02:15

6. This tutorial was absolutly amazing!
Simple

View Tutorial          By: Anita at 2009-05-09 06:29:21

7. It worked. Thank U!
View Tutorial          By: Abhijit Kurane at 2010-12-27 11:01:48

8. Thanks...
View Tutorial          By: SHUVO at 2015-07-01 21:20:47

9. Please help .... I can't access this code. so any
View Tutorial          By: Sonu Kumar at 2014-02-26 11:31:08

10. To RUN this code, follow below steps


View Tutorial          By: Ajay at 2010-09-04 03:01:24