Question: Question 2 In the class RecStuff write another static recursive method called removeLast which will take a string argument sPhrase, and a StringBuffer argument, sKey.

Question 2

In the class RecStuff write another static recursive method called removeLast which will take a string argument sPhrase, and a StringBuffer argument, sKey. The purpose of this method will be to return a string which is a copy of the original string with the last occurrence of any character that occurs in the key sequence removed from the original string. For example, consider the string The sly moon is high in the sky. If provided with a key sequence of ken, the returned string would be The sly moon is high i th sy. You can assume that the key sequence will always contain unique characters.

The Method signature for this will be

public static String removeLast(String sPhrase, StringBuffer sKey)

Note: we are using a StringBuffer here because unlike Strings, StringBuffers can be modified.

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!