1
I need to compare if the name typed in textField is equal to the "root" user. At the time of comparing even typing root the Eclipse informs that it is invalid. Unfortunately I don’t understand the reason for the mistake.
// ...
model.Usuario mUser = new Usuario();
// Enviar Usuario e Senha
String tfUser = tfUsuario.getText().toString().trim();
char[] tfPassword = tfSenha.getPassword();
mUser.setUser(tfUser);
mUser.setPassword(tfPassword);
// ...
if(tfUsuario.getText() == "root") {
JOptionPane.showMessageDialog(null, "Válido", "Aviso", 0);
System.out.print(tfUsuario.getText());
} else if(tfUsuario.getText() != "root") {
JOptionPane.showMessageDialog(null, "Inválido", "Aviso", 0);
System.out.print("Nome do Usuário: " + tfUsuario.getText());
}
That’s why I score negative?
– Júnior