Array Required, but java.lang.String found
Hey guys. First time visitor so hey once again ^^.
Im trying to create a script that will let me store specific data in a set of objects using an arraylist, but have seemed to have hit a wall. with the error
Array Required, but java.lang.String found
Code:
ArrayList<String> gates = new ArrayList<String>(200);
public void loadGates() {
Connection con = null;
String gateName = "";
int xLoc;
int yLoc;
int zLoc;
String gates ="";
con = etc.getSQLConnection();
try
{
count = 0;
Statement st = con.createStatement();
ResultSet counter =st.executeQuery("SELECT COUNT(*****) FROM gates");
ResultSet res = st.executeQuery("SELECT * FROM *****");
while(res.next())
{
gateName =res.getString("gateName");
xLoc = res.getInt("*****");
yLoc = res.getInt("*****");
zLoc = res.getInt("*****");
gates[count]= new Gate(gateName,xLoc,yLoc,zLoc);
count++;
}
}
catch(SQLException SQLException1)
{
log.info("SQL Error occured"+SQLException1);
}
}
Also, if it is also needed...
Code:
public class Gate
{
String GName;
public int x;
public int y;
public int z;
public Gate()
{
}
public Gate(String gateName, int xLoc, int yLoc, int zLoc)
{
this.GName = gateName;
this.x = xLoc;
this.y = yLoc;
this.z = zLoc;
}
}
This had really got me stumped.Could someone please explain whats goingon here and how to fix it?
Much thanks,
Raider00321