public class MemberAccoutList{
private ArrayList<MemberAccount> membrAcc = new ArrayList<MemberAccount>();
public ArrayList<MemberAccount> getMembrAcc()
{
return membrAcc;
}
}
public class MemeberAccount{
private int mobileNumber;
private String password;
//Create a MemberAccount constructor
public MemberAccount(int mobNum, String pswd)
{
this.mobileNumber = mobNum;
this.password = pswd;
}
public void setMobileNumber(int mobileNumber)
{
this.mobileNumber = mobileNumber;
}
public int getMobileNumber()
{
return mobileNumber;
}
}
public class Validation{
public boolean joinValidation(String num,String pass, String pass2){
int number = Integer.parseInt(num);
for(MemberAccount memb : ma.getMembrAcc())// why this isn't working??? it gives me null
{
if(memb.getMobileNumber() == number)
{
JOptionPane.showMessageDialog(null, "The mobile number already exist","Error",JOptionPane.ERROR_MESSAGE);
return false;
}
}
}
}
}