Menu

Java 3a Write Method Accept String Array Strings Method Return Number Strings Begin Str St Q43779899

JAVA

3a) Write a method will accept a String and an array of Strings.This method should return the number of strings that begin withstr.

startsWith(“th”, {“hola”, “word”, “night”, “boom”}) → 0
startsWith(“th”, {“the”, “t”, “these”, “two”, “theory”, “bath”}) →3
startsWith(“pre”, {“prefix”, “pre”, “pretend”, “promise”,“protoss”, “abcpre”}) → 3

public static int startsWith(String str, String[] words)
{

}

Expert Answer


Answer to JAVA 3a) Write a method will accept a String and an array of Strings. This method should return the number of strings th…

OR