File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Vector problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Vector problems" Watch "Vector problems" New topic
Author

Vector problems

Vanessa Laffoon
Greenhorn

Joined: Apr 06, 2004
Posts: 2
Hi all. I need some help with Vector.

I have a Vector:
Vector oneDimArray = new Vector();
That I'm trying to get to do this for loop:

for (int counter1 = 0; counter1 < 10; counter1++)
{
oneDimArray = counter1 + (" ");
}

and I'm getting an error on incompatible types. String was found but Vector is required (it points me to the + inside the for loop). How do I get the Vector oneDimArray to accept the new value of the string counter1 + (" "); ?
Btw, I'm a webdesign major, emphasis on design, lol, I don't have a logical bone in my body but am forced to take Java Maybe I'd be better at it if I wasn't forced to take it.
Vanessa
Billybob Marshall
Ranch Hand

Joined: Jan 27, 2004
Posts: 202
oneDimArray.add(String.valueOf(counter1));
- or -
oneDimArray.add(new Integer(counter1));
depending on what you really want to put in that vector - String-ified integers, or Integers.
Vanessa Laffoon
Greenhorn

Joined: Apr 06, 2004
Posts: 2
Woohoo! Thank you so much.. I've been frustrated with this for a week now.. I hate this class because the instructors know Java so well, they can't teach it.. They give us the barest overview then expect those of us who have never had any programming before to be able to understand it and dechiper the API.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Vector problems