ArrayList<Student> al = new ArrayList<Student>();
Iterator itr = al.iterator();
while (itr.hasNext())
{
Student st = (Student) itr.next();
System.out.println(st.rollno+" "+st.name+""+st.age);
}
Assume Student class having three data members rollno,name and age. So,my question is why we downcast in the statement Student st=(Student)itr.next(); But if we make an ArrayList having String as types of data members,then there is no need to downcast it using iterator again. Please help to clear my doubt.