CSC300: String Interning [10/23] Previous pageContentsNext page

String a = new String ("Hello");
String b = new String ("Hello");
String x = a.intern();
String y = b.intern();
x=Hello, y=Hello
                  x==y : true
   Objects.equals(x,y) : true
           x.equals(y) : true
eqs04

Previous pageContentsNext page