Question: Write the following merhods in a Java class 5. Write a static method called replaceString that takes in an array of Strings, a String to
5. Write a static method called replaceString that takes in an array of Strings, a String to find, and a String to replace it with. It then replaces all instances of the first string with the second string. For example, given an array ("grains", "meat", "dessert", "fruit", "vegetables"), and strings "dessert" and "more vegetables", the method would return ["grains", meat", "more vegetables", "fruit", "vegetables"). 6. Write a static method called reverse that takes in an array, and reverses it. For example, given [1, 2, 3, 4], the method would return [4, 3, 2, 1). You may need to use another array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
