Here the below code is used to convert list of string object(ArrayList with String) to String Array(String[ ])
using toArray( ) method on ArrayList object we can convert arraylist to string[]
ArrayList<String> number_list = new ArrayList<String>();
number_list .add("one");
number_list .add("two");
number_list .add("three");
String[] numberArr = new String[number_list .size()];
numberArr = number_list.toArray(numberArr );
using toArray( ) method on ArrayList object we can convert arraylist to string[]
ArrayList<String> number_list = new ArrayList<String>();
number_list .add("one");
number_list .add("two");
number_list .add("three");
String[] numberArr = new String[number_list .size()];
numberArr = number_list.toArray(numberArr );
No comments:
Post a Comment