...
This compliant solution uses the Object.equals()
method when comparing string values.:
Code Block | ||
---|---|---|
| ||
public class StringComparison { public static void main(String[] args) { String str1 = new String("one"); String str2 = new String("one"); System.out.println(str1.equals( str2)); // Prints "true" } } |
...