Hi,
Sorry.I didn't get the result using conversion of vector to integer.
My problem is that ,I am getting values from the database.Following is the code:
while(rs1.next())
{
vectorx1.add(rs1.getString(1));
vectory1.add(rs1.getString(2));
vectorw1.add(rs1.getString(3));
vectorh1.add(rs1.getString(4));
}
where vectorx1,vectory1,vectorw1 and vectorh1 are of type Vector.Here I made the conversion is like this:
for(int pn=0;pn<=vectorx1.size();pn++)
{
x1=Integer.parseInt((
String)vectorx1.get(pn));
y1=Integer.parseInt((String)vectory1.get(pn));
w1=Integer.parseInt((String)vectorw1.get(pn));
h1=Integer.parseInt((String)vectorh1.get(pn));
}
where x1,y1,w1 and h1 are of type "int".
The other way also I tried.i.e., :
while(rs1.next())
{
vectorx1.add(new Integer(rs1.getInt(1)));
vectory1.add(new Integer(rs1.getInt(2)));
vectorw1.add(new Integer(rs1.getInt(3)));
vectorh1.add(new Integer(rs1.getInt(4)));
}
and the conversion to integer is made like this:
for(int pn=0;pn<=vectorx1.size();pn++)
{
x1=((Integer)vx.elementAt(pn)).intValue();
y1=((Integer)vy.elementAt(pn)).intValue();
w1=((Integer)vw.elementAt(pn)).intValue();
h1=((Integer)vh.elementAt(pn)).intValue();
}
Using these two ways I am getting an exception "ClassCastException". But I didn't understand what is the problem of my code.You please urgently give me an idea.I need a solution for this very urgently.If you give it today if possible I am greatly thankful to you.
Thank you.