Comparing Strings: ==, .equals(), .compareTo(), ...
Tutorial Details:
Strings can not be compared with the usual <, <=, >, or >= operators, and the == and != operators don't compare the characters in the strings.
Comparing objects vs. primitive types
[to be supplied]
Comparing Strings: ==, .equals(), .compareTo(), ...
To compare Strings for equality, don't use ==. The == operator checks to see if two objects are exactly the same object. Two strings may be different objects, but have the same value (have exactly the same characters in them). Use the .equals() method to compare strings for equality. Similarly, use the .compareTo() method to test for unequal comparisons.
Rate Tutorial: http://www.roseindia.net/java/java-tips/data/strings/12stringcomparison.shtml
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: String Comparison
View Tutorial: String Comparison
Related
Tutorials:
Java Tip 76: An alternative to the deep copy technique
Java Tip 76: An alternative to the deep copy technique |
Create forward-compatible beans in EJB,
Part 1 - JavaWorld December
1999
Create forward-compatible beans in EJB,
Part 1 - JavaWorld December
1999 |
Java performance programming,
Part 3: Managing collections - JavaWorld February 2000
Java performance programming,
Part 3: Managing collections - JavaWorld February 2000 |
StringBuffer
versus String - JavaWorld March
2000
StringBuffer
versus String - JavaWorld March
2000 |
Use the JVM
Profiler Interface for accurate timing -
JavaWorld
Use the JVM
Profiler Interface for accurate timing -
JavaWorld |
Add drag and drop to your JTrees - JavaWorld Tip
97
Add drag and drop to your JTrees - JavaWorld Tip
97 |
C# : A language alternative or just J--? (part1)
C# : A language alternative or just J--? (part1) |
Design for
performance, Part 3: Remote interfaces - JavaWorld March
2001
Design for
performance, Part 3: Remote interfaces - JavaWorld March
2001 |
Accelerate your RMI
programming
Accelerate your RMI
programming |
Think small: Java on Compaq's iPAQ
Think small: Java on Compaq's iPAQ |
Comparison between the two major JDO architectures
Comparison between the two major JDO architectures |
Interesting
informations
Interesting
informations |
J2ME devices:
Real-world performance
J2ME devices:
Real-world performance |
Sort it
out
Sort it
out |
Use select for
high-speed networking
Use select for
high-speed networking |
Sizeof for
Java
Sizeof for
Java |
Trustin Lee\'s String/Object Converter - Changes
TL-convert
Trustin Lee's String/Object Converter provides a simple API to convert Java objects into strings and vice versa. It is developed to replace Jakarta Commons BeanUtils and Jakarta Commons Convert and to provide only String/Object converters.
|
SQL Uniform
SQL Uniform is a general interface (GUI), a helper application to relational databases of various types regarding query, maintenance, data comparison, export (convert). |
Advanced Synchronization in Java Threads
In this chapter, we look at some of the more advanced issues related to data synchronization--specifically, timing issues related to data synchronization. When you write a Java program that makes use of several threads, issues related to data synchronizat |
Accessing Database from servlets through JDBC!
Accessing Database from servlets through JDBC!
Java Servlets
J ava Servlets are server side components that provides a powerful mechanism for developing server side of web application. Earlier CGI was developed to provide server side capabilities |
|
|
|