String的赋值方法:
String str = "Hello,world";
String s = new String("Hello,world");
String的比较:
String str1,str2;
String str1 = "Hello,world";
String str1 = "Hello,world";
str1等于str2, 因为它们只想同一个引用;
String s1 = new String("Hello,world");
String s2 = new String("Hello,world");
s1不等于s2,因为它们比较的是地址,所以不相同;
String str1 = "Hello,world";
String s1 = new String("Hello,world");
str1不等于s1,因为s1比较的是地址,所以不相同;