Assume that a typical Reference Class called Student is accessible by the following method called linearSearch. Notice that the code for linearSearch is not complete. Assume further that the Student class has an attribute called lastName and that the class has a getter mehod called getLastName() . Which statements may be used to complete the definition of the linearSearch method so that the method uses the linear search algorithm and that the method returns true if there is a student in an array of Student with a lastName that matches the searchKey. a. studs[index].getLastName().equals(searchKey) b. studs[index].getLastName().compareTo(searchKey) == 0 c. studs[index].getLastName().equalsIgnoreCase(searchKey) d. studs[index].getLastName().compareToIgnoreCase(searchKey) == 0 e. Not given
Assume that a typical Reference Class called Student is accessible by the following method called linearSearch. Notice that the code for linearSearch is not complete. Assume further that the Student class has an attribute called lastName and that the class has a getter mehod called getLastName() . Which statements may be used to complete the definition of the linearSearch method so that the method uses the linear search
a. studs[index].getLastName().equals(searchKey)
b. studs[index].getLastName().compareTo(searchKey) == 0
c. studs[index].getLastName().equalsIgnoreCase(searchKey)
d. studs[index].getLastName().compareToIgnoreCase(searchKey) == 0
e. Not given
Step by step
Solved in 2 steps