Java字符串到字符串数组


Java字符串到字符串数组

import java.util.ArrayList;

import java.util.List;



public class ListOfStringsToStringArray {

   public static void main(String args[]) {

      List<String> list = new ArrayList<String>();

      list.add("JavaFX");

      list.add("HBase");

      list.add("OpenCV");

      String[] myArray = new String[list.size()];

      list.toArray(myArray );

      System.out.println("Contents of the String array are :: ");



      for(int i=0; i<myArray.length; i++) {

         System.out.println(myArray[i]);

      }

   }

}