|
Very simple stuff here, casting a string array to
an object array and back to another string array, works fine
String[] strArray1 = new
String[]{"A","B","C"};
Object[] objArray1 = (Object[])strArray1; String[] strArray2 = (String[])objArray1; Now, a vector that calls toArray() that returns an
array of objects, but when you cast that array to one of strings it throws a
ClassCastException
Vector v = new
Vector();
v.addElement("A"); v.addElement("B"); v.addElement("C"); Object[] objects =
v.toArray();
String[] strings = (String[])objects; /* blows up here */ What's the difference between the last two lines of
each section of code.
Thanks for the help,
Jeremy
|
- Re: Object[] cast to String[] Jeremy Cobb
- Re: Object[] cast to String[] John Zukowski
- Re: Object[] cast to String[] Thom Burnett
- Re: Object[] cast to String[] Paul Brinkley
- RE: Object[] cast to String[] Premal Jhaveri
- Re: Object[] cast to String[] RTSS - Rich Bagley
