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 jtextfield
s , jpasswordfield
s 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
Post a Comment