Мне нужна помощь в том, как вернуть логический метод в java. Это пример кода:
public boolean verifyPwd(){
if (!(pword.equals(pwdRetypePwd.getText()))){
txtaError.setEditable(true);
txtaError.setText("*Password didn't match!");
txtaError.setForeground(Color.red);
txtaError.setEditable(false);
}
else {
addNewUser();
}
return //what?
}
Я хочу, чтобы verifyPwd()
возвращал значение true или false всякий раз, когда я хочу вызвать этот метод. Я хочу вызвать этот метод следующим образом:
if (verifyPwd()==true){
//do task
}
else {
//do task
}
Как установить значение для этого метода?