Question: Question points ) Implement a new remove method in the String class you worked on for HW 2 . The method should return a new

Question points)
Implement a new remove method in the String class you worked on for HW2.
The method should return a new String object that represents the text you would
end up with if all occurrences of a given char were removed from the String. For
example, in the code below, answer should represent the text "bkstre" and true
should be printed the screen.
char[] bookstoreA ={'b','o','o','k','s','t','o','r',
'e'};
char[] bookstoreA 'b','o','o','k','s','t','o','r',
'e'};
String bookstore = new String(bookstoreA);
String bkstre = new String (bkstreA);
String answer = bookstore.remove('o');
System.out.println(answer.equals (bkstre));
In the text area below, type in your definition of the remove method. (In other
words, type in the code that should replace the //TODO comment.) Your code
cannot call any methods. Also, like on HW2, you cannot make any use of Java's
built in String class in any way. This means, for example, that you cannot use + on
Strings. You can declare variables of type String, but this will be our HW2 String
class, not Java's.
/* text for other methods not listed for the sake of space */
 Question points) Implement a new remove method in the String class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!