java - JPasswordField length skips the check -


i have been reading this: http://docs.oracle.com/javase/tutorial/uiswing/components/passwordfield.html have problem. got simple method checks if jtextfields , jpasswordfields empty or not

so have one:

private boolean addcustomercheckvalidinfo() {     for(jpasswordfield pf : newcustomerpasswordfields)     {         if (pf.getpassword().length == 0);         {             system.out.println("password length " + pf.getpassword().length);             return false;         }     }      return true; } 

the same returns false , writes in console:

password length 3 

as have read on oracle guide, passfield.getpassword().length should return length (as in system.print.out), why fail @ if it's equals 0 when it's > 0?

if (pf.getpassword().length == 0); 

you have typo. added ";" @ end of if statement. created empty if statement. rid of ";".


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -