Am trying to read Vector values and cast each element to a Form object. The following is an example code that am building.

public Form testMe() {
Form frm = new Form("Am testing");
Vector listOfFormsVector = xml.getForms();
for (int i = 0; i < listOfFormsVector.size(); i++) {
frm = (Form) listOfFormsVector.elementAt(i);
System.out.println("My Form: " + frm);
return frm;

I compiles fine but returns a ClassCastException exception. Can someone tell me why this exception.

Thank you in advance.