Westonci.ca offers quick and accurate answers to your questions. Join our community and get the insights you need today. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform.

Consider the following method substringFound, which is intended to return true if a substring, key, is located at a specific index of the string phrase. Otherwise, it should return false.
public boolean substringFound(String phrase, String key, int index)
{
String part = phrase.substring(index, index + key.length());
return part.equals(key);
}
Which of the following is the best precondition for index so that the method will return the appropriate result in all cases and a runtime error can be avoided?
A. 0 <= index < phrase.length()
B. 0 <= index < key.length()
C. 0 <= index < phrase.length() + key.length()
D. 0 <= index < phrase.length() - key.length()
E. 0 <= index < phrase.length() - index