Parse the Object your getting from the Vector element:
Say you have the following code // .... // ..... String str = v.get(indexOfCity); StringTokenizer strToken = new StringTokenizer(str,","); while(strToken.hasMoreElements()){ //... you get the token values here... System.out.println(strToken.nextToken()); } // ..... // ....
Ok... so you are not loading any user-defined Object into the vector. As each elevemt of the vector is a string, follow the instructions given by Matt and cast the value obtained into a String.
After you get the string, StringTokenizer can be used.
Two more points (which translates to about 2 cents worth): 1) It looks like you are losing the first line of the file. 2) There is no point in putting all the data in a Vector, if it is just lines from a file. You are only deferring the parsing to a subsequent loop through the Vector. You may as well parse the lines as soon as you get them; if you are creating some objects from the parsed data, it might be worthwhile to collect those objects in the Vector.