Hello! I have the below code and want to add to, then iterate through the array list whenever a user presses the register button. I've tried .get but it prints junk like this onto the screen: UserData@7f0c871e
Code:
public class RegButtonListener implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
if(!userBox.getText().equals("") && !passBox.getText().equals(""))
{
UserData user = new UserData();
user.CreateUser(userBox.getText(), passBox.getText(), 5000);
userInfo.add(user);
}
}
}
Then, here is the UserData class:
Code:
class UserData
{
String name;
String pass;
int ID;
public void CreateUser(String name, String pass, int ID)
{
this.name = name;
this.pass = pass;
this.ID = ID;
}
}
Any easier or better way to do this?