Question: public class StringList {//an array that maintains a list of String objects//the default initial size of the array is 10 private String[] strings;//the number of

public class StringList {//an array that maintains a list of String objects//the default initial size of the array is 10 private String[] strings;//the number of valid String objects stored in the//array of strings private int count;} Implement a method removeLast that takes as input a String and removes the last occurrence of that String in the list. lf the String does not appear in the list the method does nothing. You may not rely on any other methods of the class. The following shows the state of the instances variables before and after a call to removeLast with the input "cat" Before: strings rightarrow {"cat", "dog", "cat", "bird", "cat", "alpaca", null, null, null, null}, count=6 After: strings rightarrow {"cat", "dog", "cat", "bird", "alpaca", null, null, null, null, null), count=5 It is also fine if you leave the item at position 5 as "alpaca" as long as count is updated correctly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
