String Array List to String Array, convert String Array List to String Array in Java, How to convert String Array List to String Array in Java
Convert String Array List to String Array in Java
Below examples show about How to convert String Array List to String Array in Java.



import java.util.ArrayList;
import java.util.Arrays;

public class StringArrayListtoStringArray {
     
        public static void main(String args[]){
             
                //ArrayList containing string objects
                ArrayList<String> aListDays= new ArrayList<String>();
                aListDays.add("Monday");
                aListDays.add("Tuesday");
                aListDays.add("Wednesday");
                aListDays.add("Thursday");

                           
                Object[] obj = aListDays.toArray();
             
                String[] str = Arrays.copyOf(obj, obj.length, String[].class);
             
                System.out.println("ArrayList converted to String array");
             
                for(int i=0; i < str.length; i++){
                        System.out.println(str[i]);
                }
        }
}

Output:-
ArrayList converted to String array
Monday
Tuesday
Wednesday
Thursday

Top search terms
  • String Array List to String Array
  • convert String Array List to String Array in Java
  • How to convert String Array List to String Array in Java
  • Example of converting String Array List to String Array in Java
  • Array to list Example
  • arrays.toArray()
  • java array toArray
  • toArray() example
  • java toArray example
  •                                                                                                                                Next

    Back to Top