Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 The Software Craftsman this week in the Agile 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
Author

Casting a String object to a Form object

Mutua Kakinyi
Greenhorn

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?

Mutua
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.

SCJP & SCMAD
http://srinathbugz.blogspot.com/
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: Casting a String object to a Form object