I'm starting in this Java and I have a problem. I make a query in mysql and I save the data in an ArrayList, of which I only need the data, without the brackets that appear at the beginning and end.
Could someone help me by telling me how to remove those brackets?
public class ArregloObservadas {
public ArrayList setArregloOBS_1(){
PreparedStatement pstmt=null;
ResultSet rs=null;
ResultSetMetaData RSMD;
Connection conn=null;
ArrayList tmp3 = null;
String sql2;
conexion opendb = new conexion();
try{ conn = opendb.getConnection();
} catch(Exception e){System.out.println(e);}
try{
sql2 = "**consulta**";
pstmt = conn.prepareStatement(sql2);
rs = pstmt.executeQuery();
RSMD = rs.getMetaData();
tmp3 = new ArrayList();
while (rs.next()){
tmp3.add(rs.getInt("id_comision"));
}
if(rs!=null){
rs.close();
rs=null;
}
if(pstmt!=null){
pstmt.close();
pstmt = null;
}
if(conn!=null){
conn.close();
conn=null;
}
}catch(Exception e){
System.out.println(e);
}finally{
try{
if(rs!=null){
rs.close();
rs=null;
}
if(pstmt!=null){
pstmt.close();
pstmt = null;
}
if(conn!=null){
conn.close();
conn=null;
}
}catch(Exception e){
System.out.println(e);
}
}
return tmp3;
}
public static void main(String[] args) {
ArregloObservadas x = new ArregloObservadas();
System.out.println(x.setArregloOBS_1());
}