Java ArrayList toArray

The toArray() method that both array collections implement does this for you. You typically use the method like this: String[] getarray = new String[array1.size()]; getarray = array1.toArray(getarray); The toArray() method here returns an array of type String[] containing all the elements from names in the correct sequence. Program       Program Source import java.util.ArrayList; … Read more…