String类型值比较
///如果是同样的字符串,那么他们是有字符串池的,所以他们引用相等,这也就是每当String值改变时,是生成了一个新的引用.
1 package com.brave.test08041; 2 3 public class StringStaticEqual { 4 5 public static void main(String[] args) { 6 // TODO Auto-generated method stub 7 String a1 = "hello"; 8 String a2 = "he"+new String("llo"); 9 String a3 = "he"+"llo"; 10 System.out.println(a1 == a2); 11 System.out.println(a1 == a3); 12 } 13 14 }