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
2. 'Numbers' is the name of his table, you need to su
View Tutorial By: Amir at 2010-09-15 10:59:20