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
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.
out.print(sTwo.compareTo(sOne)) would display
//(sOne - sTwo)
('e' - 'a') which is 4.
Hope this will help you.
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Subscribe to Tutorials
4. The sample code was all I needed to figure out how
View Tutorial By: David at 2011-08-28 07:34:28
5. Plz can u give me some more examples of recursion.
View Tutorial By: Asadullah at 2010-01-23 06:38:58
6. Please don't use DataInputStream to read text. Unf
View Tutorial By: Peter Lawrey at 2013-01-30 23:46:47
7. I did all steps, but it only shows the first pictu
View Tutorial By: behzad at 2012-07-15 16:32:41
8. Good example. However as someone said, it would be
View Tutorial By: Neo Cambell at 2010-03-10 11:02:06
10. This tutorial is really fantastic.It helped me a l
View Tutorial By: Rakesh Verma at 2008-06-25 13:25:23