Write the WordSandwich method allSandwiches. This method creates and returns a new array of String objects as follows. Each element of the array will be a sandwich of str1 and str2: that is the characters of str2 are inserted into str1. The first String in the array consists of 1 letter of str1 followed by str2, followed by the rest of the letters of str1. For each subsequent String in the array the position in str1 where str2 starts is shifted by 1 until the final string in the array which consists of all but 1 letter of str1 followed by str2, followed by the final remaining letter of str1. For example, the call allSandwiches ("bread", "ham") will return the following array.
+5
Answers (1)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write the WordSandwich method allSandwiches. This method creates and returns a new array of String objects as follows. Each element of the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Home » Computers & Technology » Write the WordSandwich method allSandwiches. This method creates and returns a new array of String objects as follows. Each element of the array will be a sandwich of str1 and str2: that is the characters of str2 are inserted into str1.