java - GWT: String comparision is not working -
i have following code in presenter in gwt mvp application:
public void onfailure(serverfailure error) { string errcode = error.getmessage(); window.alert(errcode); window.alert("server error: pleaseenterquestion"); if(errcode == "server error: pleaseenterquestion") window.alert("same"); else window.alert("different"); }
the first 2 alerts same. third alert different
. expect same
.
use equals
, not ==
, compare strings:
if("server error: pleaseenterquestion".equals(errcode))
see question more information: how compare strings in java?
Comments
Post a Comment