Converting Arraylist of objects to array of objects
import user.java; Public class sample { public static void main(String [ ] args) user custBillToCode[] = new user [data.getBillToCodeList().size ()]; //User custBillToCode[] = (user[]) data.getBillToCodeList().toArray(new user [newgrinfo.getBillToCodeList().size ()]); for (int i = 0; i < newgrinfo.getBillToCodeList().size(); i++) { User obj = (User) newgrinfo.getBillToCodeList().get(i); custBillToCode[i] = obj; System.out.println(" My objects = "custBillToCode[i]); } ArrayList vaList = new ArrayList() ; vaList.add("VA1"); vaList.add("VA2"); vaList.add("VA3"); String[] vaStrArray = new String [vaList.size ()]; vaList.toArray(vaStrArray); for(int count=0;count<vaStrArray.length;count++) { System.out.println(" My Strings="+vaStrArray[count]); } } }