The result should be like [1,2,3,4]
,
but i get garbled result like this
[com.test.db.Network@383c7b61, com.test.db.Network@7f87898, com.test.db.Network@6b93f47a, com.test.db.Network@50fb09cc]
Below is my related class
private static void doLocationList(PrintWriter responseOut) throws Exception
{
//---testing show network ID list
int x=0;
Network network = new Network();
responseOut.println("this is I: " +network.getNetworkID(x));
......
}
This is from another class
public static List<Network> getNetworkID(int networkID) throws Exception
{
List<Network> idList = new ArrayList<Network>();
Connection conn = getConnection();
PreparedStatement Statement = conn.prepareStatement("Select id from network");
ResultSet result = Statement.executeQuery();
while(result.next()) {
Network network = new Network();
network.setId(result.getInt("id"));
idList.add(network);
}
return idList;
}
Any idea? Please help.