This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Conversion of Vector() to string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Conversion of Vector() to string" Watch "Conversion of Vector() to string" New topic
Author

Conversion of Vector() to string

Priya mathi
Greenhorn

Joined: Nov 15, 2000
Posts: 4
hai,
I am storing names which is in array in a Vector() object.
but after that i want to convert that Vector() back to String
i tried using toString(),
but it gives error as wrong arguments.
Is there a way
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
Vectors store their data as Objects only, so you have to cast back to the object type that you want.
To retrieve you String object, use something like:

This would retrieve the String object that is the first element in the Vector. Vectors, like arrays, are zero-based.
Hope this helps,
Michael
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Conversion of Vector() to string
 
Similar Threads
A question about generic type
EduardoCobian Q 29
Using result sets, statements & connections
decimal place formatting JtextField
declaring a new Vector