Hello all, I have a Vector that I previously filled with String values coming from a String array. Now , I need to get back my String  array from the vector. The method Vector.toArray(Object a) doesn't works and I don't knwo why.
This code will not work and will throw a java.lang.ArrayStoreException, unless I uncomment the for loop and comment this line :columns=(String)subVector.toArray(columns); I don't understand why? Isn't it supposed to do the same? If anybody has an idea, I would be glad to understand. Thx in advance [ April 03, 2003: Message edited by: Younes Essouabni ]
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
Thank you Michael, thank you Weerawit. It sees that you were right, there isn't only string object. That's the reason why this one works: columns[j]=subVector.elementAt(j).toString(); and this one doesn't works : columns[j]=(String) subVector.elementAt(j); I thought that both were the same, but it is not. One is "translating" an object into a string, and the other is casting an object into a string, which is permitted as long as the object effectively contains a string. Thank you for your help