I have s simple UDP program where the server prints out the message from the client. However, if the client sends a phrase, in this case its "password", it should print another phrase ("123456").
However, when I send the string "password" using the client, the server does not recognise it and instead prints out "password".
May I know where I went wrong?
String sentence = new String( receivePacket.getData());
if(sentence == "password"){
System.out.println("123456");
}
System.out.println(sentence);