The following code does not handle the substring correctly. It is printing the last line of code even when ShortAcctNm equals DEMO. I have just started to program in Java so I must be misunderstanding something. Please help. (I also checked to make sure it was the letter O not a zero)
public void onTick(Instrument instrument, ITick tick) throws JFException {
Ask = tick.getAsk();
Bid = tick.getBid();
TickTime = tick.getTime();
AcctNm=engine.getAccount();
String ShortAcctNm = AcctNm.substring(0,4);
console.getOut().println(":"+ShortAcctNm+":");
if (ShortAcctNm != "DEMO") console.getOut().println("xxx"); // this should not print for DEMO account
Messages
01:44:53 xxx
01:44:53

EMO:
01:44:53 xxx
01:44:53

EMO:
01:44:52 xxx
01:44:52

EMO: