Iterator iterate = list.iterator(); while(iterate.hasNext()) { Student student = (Student) iterate.next(); if(a == (int)student.roll_no) { try { System.out.println("Re-enter your roll no. : "); a = Integer.parseInt(br.readLine()); } catch(Exception e) { e.printStackTrace(); } }
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to com.Student
Integer
Student
iterate
a
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)