1List<String> cities = new ArrayList<String>();
2cities.add("Tuguegarao City");
3cities.add("Tabuk City");
4cities.add("Davao City");
5
6System.out.println(cities.get(1)); //prints "Tabuk City"
1// to use index on ArrayList you have to use the getmethod.
2for (int x = 0, y = myarraylist.size(); x < y; x++)
3{
4 totalsum += myarraylist.get(x);
5}