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, 22.06.2019 01:00
What is added to the < meta > tag to describe the encoding type?
Answers: 1
question
Computers and Technology, 22.06.2019 13:30
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. centurion: a commander in the army of ancient rome. keyword: picture:
Answers: 2
question
Computers and Technology, 24.06.2019 14:00
In simple terms, how would you define a protocol?
Answers: 2
question
Computers and Technology, 25.06.2019 08:30
Ais a modeling tool used in structured systems analysis and design (ssad) analysis model that break down a complex process into simpler, more manageable, and more understandable subprocesses
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
History, 21.01.2021 01:00
question
Physics, 21.01.2021 01:00
question
Mathematics, 21.01.2021 01:00
question
Mathematics, 21.01.2021 01:00
question
Mathematics, 21.01.2021 01:00
question
English, 21.01.2021 01:00
question
Mathematics, 21.01.2021 01:00
Questions on the website: 13722362