Possible Duplicate:
why does List<String>.toArray() return Object[] and not String[]? how to work around this?
See this code example :
List<String> list = new ArrayList<String>();
list.add("hello");
list.add("world");
Object [] array = list.toArray();
Why does the method toArray() return an array of Object ? Other List methods such as get() , remove() are able to return the type of objects in the list.
toArrayusing generics or to look atArrayListcode, for example.