Store int values into dynamic array
Hello all,
I'm a newbie in JAVA whose want to store int values (coming from a resultset) into an dynamic array. I know that normally to create a "dynamic array" you'd better use a Vector, but it seems that I don't know how to use it correctly (throws me a exception as : Incompatible type for method. Can't convert int[] to java.lang.Object[]).
Thanks in advance
STF
You can't store simple types (int, char, double...) in a Vector. You must wrap them in objects. There is a class fore each simple type: Integer for int and Char for char...myVector.add(new Integer(anInt));
I want to use the copyInto method of the vector, but it throw me an exception as ')' expected
I include a snip of my code below ;
Vector v= new Vector();
Vector vv=new Vector();
String[] labels=new String[v.size()];
Integer[] values=new Integer[vv.size()];
cont=rs.getInt("COUNT(CASE_ID_)");
vv.add(j,new Integer(cont));
log=rs.getString("ORIG_SUBMITTER");
v.add(j,new String(log));
v.copyInto(String[] labels);
vv.copyInto(Integer[] values);