/** * Created by Mr SJL on 2016/12/16. * * @Author Junlan Shuai */ @RunWith(BlockJUnit4ClassRunner.class) publicclassTest1 { @Test publicvoidtest1() { String a = "helloWorld"; String b = "helloWorld"; String c = new String("helloWorld"); String d = "hello"; String e = new String("hello"); String temp = "World"; String f = "hello" + temp; String g = "hello" + "World";
System.out.println("(1) a=b:" + (a == b)); System.out.println("(2) b=c:" + (b == c)); System.out.println("(3) a=d:" + (a == (d + "World"))); System.out.println("(4) a=e:" + (a == (e + "World"))); System.out.println("(5) c=d:" + (c == (d + "World"))); System.out.println("(6) c=e:" + (c == (e + "World"))); System.out.println("(7) a=g:" + (a == g)); System.out.println("(8) a=f:" + (a == f)); } }