0
I take all my values from the database and put them in one array list<object>
i would like to know how to access the value within this arraylist emu, for example TesteLinhas.get(0).toString()
or something like return me to where it is allocated in memory, I believe. I would like me to get the value of it. There is some way?
ArrayList linhas = new ArrayList();
String sql = "SELECT * FROM tb_zerados ORDER BY id ASC";
conexao.pstm = conn.prepareStatement(sql);
conexao.rs = conexao.pstm.executeQuery();
while(conexao.rs.next()){
linhas.add(new Object[]{conexao.rs.getInt("id"),
conexao.rs.getInt("numero"),
conexao.rs.getString("ano"),
conexao.rs.getString("nome"),
conexao.rs.getString("estilo"),
conexao.rs.getString("plataforma"),
conexao.rs.getInt("nota")});
}
System.out.println(linhas.get(1));
He returns it to me: [Ljava.lang.Object;@28a8f402
, and I’d like you to return a String
or a Integer
.
Hello, he sent me mistakes, but I already got the solution with the other who answered. Thank you anyway. Another thing, I wonder why you mean it’s wrong for me to do it like this? I did this way to fill a table using a Tablemodel.
– Hamon Córdova
It is complicated to answer in a comment, basically you should have a class to deal with it and not throw everything into one array.
– Maniero