I was wondering how is it possible to remove an object from array list using a String. For example I have a class with Students and when I call the remove method I input Name and Last name and the method removes that student from the ArrayList.
I already made a method using exception, but always get the exception
public Student rmv(String name, String lname) throws MyException{
if(students.contains(new Student(name, lname))){
students.remove(new Student(name, lname));
}else{
throw new MyException("Doesn't exist");
}
return null;
}