[SOLVED] Problem with an If Statement.
Hey again.
I am trying to get a while loop to work only when it gets a certain string sent back to the server.
This is the code:
Code:
public void ServerCMDS(String NxtCmd) throws java.rmi.RemoteException
{
i = 1;
if (NxtCmd == "/ShowUsers") {
while (i <= LoggedInCount) {
System.out.println(UsersLoggedIn[i]);
i++;
}
i = 0;
}
}
Now if i print out the NxtCmd to the screen it shows exactly what i just typed. I.E. /ShowUsers
But for some reason the IF statement will not work, maybe im doing it wrong.
If i remove the if statement the while loop will run no problem.
Any ideas?
Thanks,
Chris