[Solved] how to add string array elements to arraylist in java
Your budgetEntityList is empty when you do budgetEntity= budgetEntityList.get(k); Doing a new ArrayList<>(capacity) does not fill your ArrayList with BudgetList objects, it only sets the initial capacity of your ArrayList. So, what you need to do is: for(int k=0; k < budgetEntityList.size() ; k++) { budgetEntity = new BudgetEntity(); budgetEntityList.add(budgetEntity); } And then, set the … Read more