String类基本问题
kaymo 2004-10-18 02:35:12 class test1 {
public static void main( String[] args ) {
String good = "Good";
String s1 = good + "bye";
String s2 = good + "bye";
System.out.println(s1 == s2);
}
}
为什么打印为false
而
class test2 {
public static void main( String[] args ) {
String s1="hello"
String s2="hello";
System.out.println(s1 == s2);
}
}
为true