Are there any specific tips you would give to someone else tackling the same problem? How would what you suggest benefit that person in solving the problem?
Comparing Strings, as they are not like primitives, could be perplexing to some people. It is not right to use the <, or >, or any other similar signs when comparing Strings. We rather uses the .compareTo() or the .equals() techniques. These techniques help us compare two strings as follows:
1. the .equals() techniques checks to see if two strings are the same, and
2. the .compareTo() technique gives numeric values (negative, positive, or zero) after checking if two Strings are equal.
When comparing Strings, we use such methods rather than the familiar mathematical signs. I believe these techniques help programmers avoid errors and problems to a certain extent.
Thursday, October 25, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment