List<Studentdb> list = teacherDao.viewstudent(facultyid, batchid1);
System.out.println("" + list);
int i = 0;
for (Iterator<Studentdb> s = list.iterator(); s.hasNext(); ) {
     System.out.println("" + i);
     System.out.println("list========" + list.get(i).getRoll());
     if (teacherDao.viewmarks(subjectcode, list.get(i).getRoll())) {
           list.remove(s);
     }
    i++;
}
When I try to delete a selected list i get the error java.lang.IndexOutOfBoundsException: Index: 3, Size: 3.
Here I have list size 3 i.e index 0 1 2 and I got the error in index 3.
 
     
     
    