[solved]-Write Recursive Method Indexof Accepts Two Strings Parameters Returns Starting Index First Q39091736

Write a recursive method indexOf that accepts two Strings as parameters and that returns the starting index of the first occurrence of the second String inside the first String (or – 1 if not found). The table below lists several calls to your method and their expected return values. Notice that case matters, as in the last example that returns – 1. Value Returned Call indexOf(“Barack Obama”, “Bar”) indexOf(“Barack Obama”, “ck”) indexOf(“Barack Obama”, “a”) indexOf(“Barack Obama”, “McCain”) indexOf(“Barack Obama”, “BAR”) 1 -1 -1 Strings have an indexOf method, but you are not allowed to call it. You are limited to these methods: Method Description equals(String other) returns true if the two Strings contain the same characters length returns the int number of characters in the String substring(int from Index, int toIndex) returns a new String containing the characters from this String from from Index (inclusive) to substring(int from Index) toIndex (exclusive), or to the end of the String if toIndex is omitted You are not allowed to construct any structured objects other than Strings (no array, List, Scanner, etc.) and you may not use any loops to solve this problem; you must use recursion. Show transcribed image text Write a recursive method indexOf that accepts two Strings as parameters and that returns the starting index of the first occurrence of the second String inside the first String (or – 1 if not found). The table below lists several calls to your method and their expected return values. Notice that case matters, as in the last example that returns – 1. Value Returned Call indexOf(“Barack Obama”, “Bar”) indexOf(“Barack Obama”, “ck”) indexOf(“Barack Obama”, “a”) indexOf(“Barack Obama”, “McCain”) indexOf(“Barack Obama”, “BAR”) 1 -1 -1 Strings have an indexOf method, but you are not allowed to call it. You are limited to these methods: Method Description equals(String other) returns true if the two Strings contain the same characters length returns the int number of characters in the String substring(int from Index, int toIndex) returns a new String containing the characters from this String from from Index (inclusive) to substring(int from Index) toIndex (exclusive), or to the end of the String if toIndex is omitted You are not allowed to construct any structured objects other than Strings (no array, List, Scanner, etc.) and you may not use any loops to solve this problem; you must use recursion.
Expert Answer
Answer to Write a recursive method indexOf that accepts two Strings as parameters and that returns the starting index of the first… . . .
OR

