Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

String vectors

794681Dec 18 2008 — edited Dec 18 2008
This may seem absolutely insane to ask to some of you, but how can I change a string in a string vector?

I know how to create a vector, get a value, and store strings for a first time, but not how to reset an element.
Vector<String> StrVec = new Vector();
StrVec.add("Hello");
StrVec.add("World");
System.out.println(StrVec.get(0));

I mean, it'd be nice if I could just StrVec.get(0)="New str"; but I can't.

I couldn't find anything useful with strings and vectors on google. All of the search results I waded through were either only setting it for the first time, or just not dealing with strings at all.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2009
Added on Dec 18 2008
5 comments
318 views