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
7. Oh, Thanks for your code, but I think you should a
View Tutorial By: Songokute at 2013-01-29 13:55:13
10. its working... thanks.. thank you very much...!!!!
View Tutorial By: Viswanathan at 2008-08-18 06:54:09