Write a program which converts a ArrayList into Array in java?
package javatute; import java.util.ArrayList; public class ArrayListToArray { public static void main(String[] args) { ArrayList list = new ArrayList(); list.add("patna"); list.add("darbhangha"); list.add("motihari"); list.add("chapra"); list.add("ara"); list.add("patna"); list.add("nalanda"); String[] strings1 = new String[5]; strings1 = (String[]) list.toArray(strings1); for (String str : strings1) { System.out.println(str); } } }