标签:new -- intern ati style bsp public int pre
public static void main(String[] args) { String a1 = new String("a_a"); String a2 = new String("a_a"); System.out.println("a:"); System.out.println(a1 == a2); System.out.println("-------------------------"); String b1 = "b_b"; String b2 = "b_b"; System.out.println("b:"); System.out.println(b1 == b2); System.out.println("-------------------------"); String c = new String("c"); String c1 = c + "_c"; String c2 = "c_c"; System.out.println("c:"); System.out.println(c1 == c1.intern()); System.out.println(c1 == c2); System.out.println(c2 == c1.intern()); System.out.println(c2 == c2.intern()); System.out.println("-------------------------"); String d = new String("d"); String d1 = d + "_d"; System.out.println(d1 == d1.intern()); String d2 = "d_d"; System.out.println("d:"); System.out.println(d1 == d2); System.out.println("-------------------------"); }
标签:new -- intern ati style bsp public int pre
原文地址:https://www.cnblogs.com/season1992/p/10358659.html