Results 1 to 1 of 1
- 04-23-2011, 11:41 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 4
- Rep Power
- 0
Casting a String object to a Form object
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.
Mutua
Similar Threads
-
Struts action form not returning object
By niteangell21 in forum Enterprise JavaBeans (EJB)Replies: 0Last Post: 02-08-2011, 05:50 PM -
Object Casting, please help
By DerekRaimann in forum New To JavaReplies: 5Last Post: 12-04-2010, 01:14 PM -
Casting Object to another type
By green_river48 in forum New To JavaReplies: 12Last Post: 04-03-2010, 10:52 AM -
Object casting
By spiderweb in forum Advanced JavaReplies: 5Last Post: 08-20-2009, 05:43 PM -
Object to Int casting
By nn12 in forum New To JavaReplies: 4Last Post: 12-06-2008, 10:58 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks