Java不等于(!=)不起作用吗? [英] Java Does Not Equal (!=) Not Working?
本文介绍了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
.
However for some reason, if (statusCheck != "success")
is returning false
, and thereby throwing the MulticasterJoinException
.
推荐答案
if (!"success".equals(statusCheck))
这篇关于Java不等于(!=)不起作用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文