wood burning stoves 2.0*
The moose likes Java in General and the fly likes Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Vector" Watch "Vector" New topic
Author

Vector

nicky sajdok
Greenhorn

Joined: Jan 22, 2003
Posts: 14
Hi
my vector holds these values
[goods out, firstname, lastname]
[id, adress1]
[country, phone]
[goods in]
How can i get the first line out([goods out, firstname, lastname]).
and after i have used this line get the next line out([id, adress1]).
And so on?
thanks
nicky
Dominic Paquette
Ranch Hand

Joined: Dec 13, 2002
Posts: 64
If you are using the Vector class you can get an element using elementAt(int index) function. I assume the elements are String[].
Vector v = new Vector();
v.add(new String[]{"string1", "string 2"});
v.add(new String[]{"string3", "string 4"});

String[] strArray = (String[])v.elementAt(0);
Hope this helps
nicky sajdok
Greenhorn

Joined: Jan 22, 2003
Posts: 14
hello
well when i try to run my code i get exception
java.lang.classCastException:
Why is this?
nicky
Dominic Paquette
Ranch Hand

Joined: Dec 13, 2002
Posts: 64
Your probably casting the returned element to the wrong type.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Vector