I have problem with removing student(supprimerEtudiant) and showing student on list (afficherEtudiant). Plz help me to review my code
Here is my code
public class Classe{
String name;
ArrayList<Student>studentList = new ArrayList<Student>();
int size = studentList.size();
int i;
Student stu = new Student();
public void ajouterEtudiant(){
for (int i =1; i<3; i++){
write("Student ID: ");
stu.id = readString();
write("Student Name: ");
stu.name = readString();
write("Student Age: ");
stu.age = readInt();
studentList.add(stu);
}
}
public int supprimerEtudiant(int i){
for (i=0; i<studentList.size();i++){
if(studentList.get(i).id.equals(stu.id)){
studentList.remove(i);
break;
}
}
return i;
}
public void afficherEtudiant(){
for (i=0; i<studentList.size();i++){
System.out.print(studentList);
}
}
}