Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 */
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions

Question

7 Name at least three selection methods.

Answered: 1 week ago

Question

9 What is meant by the processual approach?

Answered: 1 week ago