subject
Computers and Technology, 20.11.2020 16:50 siyah87

20 pts, please write in JAVA. need this ASAP In the Lesson Slides for this activity, we developed a method findChar for figuring out if a character was in a String.

The implementation was:

public boolean findChar(String string, String key)
{
for(int index = 0; index < string. length(); index++)
{
String character = string. substring(index, index+1);
if(character. equals(key))
{
return true;
}
}
return false;
}
However, there is a much more efficient and simple algorithm that we can use to determine if a character is in a String. Using the method signature public boolean findChar(String string, String key), figure out a more efficient method with a lower exection count.

Hint: We’ve learned a couple of methods that can tell us what index a character is at - can we use those to determine if the character is in a String?

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 16:00
Which analyst position analyzes information using mathematical models to business managers make decisions?
Answers: 1
question
Computers and Technology, 24.06.2019 03:30
Which explains extrinsic motivation? a)motivation in which there is a reward b)motivation that is personally satisfying c)motivation that is personally meaningful d)motivation in which the subject is interesting
Answers: 1
question
Computers and Technology, 24.06.2019 12:10
What is it called during the editing process when the processor ensures that a character holding a coffee mug from one angle is holding the same mug in the same way when the shot switches to another camera at another angle? cinematography continuity technology prop use
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
What is a dashed line showing where a worksheet will be divided between pages when it prints? a freeze pane a split box a page break a print title
Answers: 1
You know the right answer?
20 pts, please write in JAVA. need this ASAP In the Lesson Slides for this activity, we developed a...
Questions
question
Biology, 02.02.2021 23:40
question
Mathematics, 02.02.2021 23:40
question
Mathematics, 02.02.2021 23:40
question
Mathematics, 02.02.2021 23:40
question
Mathematics, 02.02.2021 23:40
question
Mathematics, 02.02.2021 23:40