samedi 15 octobre 2016

Need help; if statements [on hold]

I'm trying to write an if statement to check if the length of password if greater or equal to 8. When I run it, it said pass for any number of characters I enter. I want it to print fail when I enter less than 8 characters.

if(password.length() >= 8) {
 System.out.println("Fail : Your password must have eight characters");
} 
else {                
 System.out.println("Pass: Your password has at least 8 characters!");
}

Aucun commentaire:

Enregistrer un commentaire