( , ), , , .
, == true.
.
Object o = new Object();
Object p = o;
System.out.println("o == p ? " + (o == p ) );
:
Object a = new Object();
Object b = new Object();
System.out.println("o == p ? " + (o == p ) );
.
, :
String x = "hello";
String y = "hello";
System.out.println("x == y ? " + (x == y ) );
, , , .
( ), equals().
.
, intern(), , .
String a = "world";
String b = new String("world");
String c = new String("world").intern();
System.out.println("a == b ? " + (a==b) );
System.out.println("b == c ? " + (b==c) );
System.out.println("a == c ? " + (a==c) );