CS 1713 Introduction to Computer Science Daily Problem
Write a method that takes a one-dimentional array of Student and a
Student as parameters and returns the index of the last entry
containing that Student. Return -1 if not found. Compare
Students using the equals method in the
class Student.
Solution:
public int findLastIndex(String[] students, Student student) {
for (int i=students.length -1;i>=0;i--)
if (student.equals(students[i])
return i;
return -1;
}