Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Casting Vector to String

843835May 13 2003 — edited May 13 2003
Hi All,

I am getting a classcastexception error when I try to cast a vector to a string, which I thought was possible.

Can anyone assist me please?

ResultSet rsFaculty = faculty.getNewFaculty();
Vector v = new Vector();
while (rsFaculty.next();
{
Vector row = new Vector();
row.add(rsFaculty.getString("FacultyID"));
row.add(rsFaculty.getString("FacultyName"));
v.add(row);
}
int vsize = v.size();
int choice = (int)(Math.random()*vsize);

String StringName = (String) v.elementAt(2);

out.println(v.elementAt(2));
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 10 2003
Added on May 13 2003
2 comments
135 views