Java不等于(!=)不起作用?

这是我的代码段:

public void joinRoom(String room) throws MulticasterJoinException {

String statusCheck = this.transmit("room", "join", room + "," + this.groupMax + "," + this.uniqueID);

if (statusCheck != "success") {

throw new MulticasterJoinException(statusCheck, this.PAppletRef);

}

}

但是由于某种原因,if (statusCheck !="success")正在返回false,从而抛出MulticasterJoinException

回答:

if (!”success”.equals(statusCheck))

以上是 Java不等于(!=)不起作用? 的全部内容, 来源链接: utcz.com/qa/403006.html

回到顶部