I’m doing some past exam papers in preparation for a forthcoming exam, and have come across this question, and I’m not sure how to solve it, I’ve written a for-each loop with an if statement but I’m not sure what the header would be and what to return. Any help would be great. Thanks.
The question:
An ArrayList named classList is used
to store Student objects.Write code for a method that
determines whether or not data for a
student with given forename and
surname is present in classList.
Something like: