标签:
public class testobj_important { public static void main(String[] args) { String a = new String("abc"); String b = new String("abc"); System.out.println(a==b); String c = "def"; String d = "def"; System.out.println(c==d); } }
false true
上面是两个不同对象
下面是指向同一常量池的对象(地址值相同)
标签:
原文地址:http://www.cnblogs.com/cydcn/p/4490708.html