subject

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

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
What season was better from fortnite?
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
Jason works as an accountant in a department store. he needs to keep a daily record of all the invoices issued by the store. which file naming convention would him the most? a)give the file a unique name b)name the file in yymmdd format c)use descriptive name while naming the files d)use capital letters while naming the file
Answers: 3
question
Computers and Technology, 23.06.2019 12:40
Curriculum exam to process a resident's payment, you must click on onesite payments home page. from the a. reports b. my settings o c.transactions o d. rent tab
Answers: 1
You know the right answer?
Consider the following method substringFound, which is intended to return true if a substring, key,...
Questions
question
Mathematics, 02.03.2021 20:00
question
Biology, 02.03.2021 20:00
question
Mathematics, 02.03.2021 20:00
question
Mathematics, 02.03.2021 20:00
Questions on the website: 13722361