...
This noncompliant code example declares two distinct String objects that contain the same value.:
| 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 == str2); // Prints "false"
}
}
|
...