Oliver Spryn Oliver Spryn - 16 days ago 5
Java Question

Java Does Not Equal (!=) Not Working?

Here is my code snippet:

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);
}
}


However for some reason,
if (statusCheck != "success")
is returning
false
, and thereby throwing the
MulticasterJoinException
.

Answer
if (!"success".equals(statusCheck))
Comments