Im trying to create classes and putting them into an ArrayList
import java.util.*;
public class UserGroup
{
ArrayList<User> userList = new ArrayList<User>();
public UserGroup()
{
}
public void addSampleData()
{
for (int i = 1; i < 11; i++)
{
String iConvert = "User" + Integer.toString(i);
System.out.println(iConvert);
userList.add(iConvert(iConvert, iConvert, iConvert));
}
}
}
was trying to use a string within the loop to change what i call each object
Below is the User class the constructor requires 3 strings that was the reason for the iConverts(iConverts, iConverts, iConverts) I was trying to name the object using a String
public class User {
/*
* contains a username, usertype and names (constructor uses these)
* methods within getUsername, getUserType, getName and setUserType
*/
String username;
String userType;
String name;
public User(String username, String userType, String name)
{
}
protected String getUsername()
{
return username;
}
protected String getUserType()
{
return userType;
}
protected String getName()
{
return name;
}
protected void setUserType(String newType)
{
userType = newType;
}
}