xxxxxxxxxx
// to use index on ArrayList you have to use the getmethod.
for (int x = 0, y = myarraylist.size(); x < y; x++)
{
totalsum += myarraylist.get(x);
}
xxxxxxxxxx
List aList = new ArrayList();
aList.add("Orange");
aList.add("Apple");
aList.add("Peach");
aList.add("Guava");
aList.add("Mango");
System.out.println("The index of the element Apple in ArrayList is: " +
aList.indexOf("Apple"));