Saturday 20 January 2018

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


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...