2
回答
求解,两个输出为什么不一样
注册华为云得mate10,2.9折抢先购!>>>   

public static void main(String[] args) {
String a = "hello2";
final String b = "hello";
String c = b + 2;       
System.out.println((a == c));
}
//true

public class Main {

public static void main(String[] args) {
String a = "hello2";
final String b = getHello();
String c = b + 2;       
System.out.println((a == c));
}

public static String getHello(){
return "hello";
}

}

//false

<无标签>
举报
ihama
发帖于2年前 2回/107阅
顶部