Students tempStudent = new Students();
ændre det til
Students tempStudent;
Du overridding
property of same object
siden du oprettede tempStudent
outside
while loop
. Du skal tilføje objects
lig med number of record
i databasen. Så opret tempStudent object
som nedenfor.
brug
while (rs.next()) {
tempStudent = new Students();
tempStudent.studentId = rs.getInt("StudentNo");
tempStudent.studentName = rs.getString("StudentName");
tempStudent.studentAge = rs.getInt("StudentAge");
students.add(tempStudent);
size++;
}