wood burning stoves*
The moose likes Java Micro Edition and the fly likes Casting a String object to a Form object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Casting a String object to a Form object" Watch "Casting a String object to a Form object" New topic

Casting a String object to a Form object

Mutua Kakinyi

Joined: Apr 21, 2011
Posts: 7
Am trying to read Vector values and cast them to a Form object. The following is an example code that am building.

public void testMe() {
String str = null;
Vector listOfFormsVector = xml.getForms();
for (int i = 0; i < listOfFormsVector.size(); i++) {
str = (String) listOfFormsVector.elementAt(i);
Form str = (Form)new Form("Am testing");

Is it possible to cast String objects to a Form object? How else do I make these string variables Form objects?

Srinath Gamage
Ranch Hand

Joined: Jun 19, 2008
Posts: 40

As I see you have String values in Vector, so you cannot cast a String to a Form.
What you can do is add those strings to a Form object.

Don't get me started about those stupid light bulbs.
subject: Casting a String object to a Form object
Similar Threads
How do I cast from Vector to String Array?
Making a String[] from ResultSet
Class Cast Exception - Please help
What Class.forName() does?