Array or Vector
I have to store 10 Strings. I can do that in Array or in Vector.
Just want to know, which one is the better choice. I am talking about memory and performance issues.
Vector <String> myValues = new Vector<String>();
String  myValues1 = new String;
If you know how many items you need to store, I think an array is the way to go. The advantage of a vector is its ability to change size. Basically if a vector is full and you add another object, the memory for that object is dynamically allocated. This does not happen in an array. To increase the size of an array, you have to create a new one and copy all of the original values.
So, in my opinion, if there is no chance that you will need more than 10 Strings, go with the array.
Thanks ShoeNinja for your opinion. I now have got the right idea.