This is a code fragment that I am working with for a logon system using hashset Users. I checked the enhanced for loop part it works but the if statement seems like it never works out, even if the values are equal.
if (comm.equals("Sign in")) {
    user urs = new user(p_name, p_pass, p_id );
    Iterator<user> iter = Users.iterator();
    for(user obj : Users) {
        if (p_u == obj.getUsername()&& p_pw == obj.getPassword ()&& p_sn== obj.getStudentID()) {
            JOptionPane.showConfirmDialog(
                jf, 
                "Success", "Success",
                JOptionPane.DEFAULT_OPTION);
            break;
        } else {
            log_in.setText("Try Again");
            exit.setText("Create User");
        }
 
     
     
     
    