[Solved] Add a string to an ArrayList


If you are declaring list as

 ArrayList data = new ArrayList();

then you get the message about parameterizing the list because data can hold any Object

If you know that you are going to add only strings in your list, declare it as

 ArrayList<String> data = new ArrayList<String>(); // pre java 7
 ArrayList<String> data = new ArrayList<>(); // valid for java 7

1

solved Add a string to an ArrayList