The code you have doesn't actually do anything to the objects in your array. If you want to specify that all the elements are Strings,
you should define the array as
String[] array, and iterate through the ArrayList. This still leaves you with the problem of having to cast each object though...
If you are using
Java 1.5, you can make use of a new feature:
Generics. To specify that all the elements in your ArrayList are Strings, you can define the ArrayList as
ArrayList<String> al = new ArrayList<String>();.
What exactly do you need to perform this conversion for? If it's just to gain access to the String methods, then you can simply perform the cast when you need to call the method - there's no need to copy everything into a String array.
[ August 31, 2004: Message edited by: Fletcher Estes ]