Friday, June 8, 2012

Convert List into Array


package com.yagapp.phaseone;


import java.util.ArrayList;
import java.util.List;


public class ListTOArray {


/**
* @param args
*/
public static void main(String[] args) {

List<String> list = new ArrayList<String>();
 
list.add("India");
list.add("Switzerland");
list.add("Italy");
list.add("France");
 
String [] countries = list.toArray(new String[list.size()]);

System.out.println(countries);

}


}

No comments:

Post a Comment