Respuesta :

Here is a pseudocode for your function, you can implement it using your programming language with syntax modifications.

int countstrings(string[] list, string target) {
int counter = 0;
for (int i=0; i<list.size(); i++) {
             if (list[i] == target)
             {
                       counter++;
             }

   }
return counter;

To write an expression for loop is executed in which string is matched with the key. StringOccurrences class is defined in which count variable is initialized with zero to count the strings. After that for loop is used to count the occurrence of targets appears in the array.

Further Explanation:

Code: Following is the Java code to find the occurrence of the string.

//StringOccurrences.java

public class StringOccurrences {

public int countTheNumberOfStringOccurrencesInAnArray(String[] strings, String key) {

int count = 0;

for(String s : strings) {

if (s.equals(key)) {

count++;

}

}

return count;

}

// Main body starts here

public static void main(String[] args) {

StringOccurrences so = new StringOccurrences();

System.out.println(so.countTheNumberOfStringOccurrencesInAnArray(new String[]{"Akshay", "Nudrat", " Akshay "}, " Akshay "));

}

}

Learn more:

1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011  

2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832  

3. The shape of our galaxy was determined ‘on the inside looking out' by surveying the milky way using ____________ telescopes. https://brainly.com/question/7866623

Answer details:

Grade: College Engineering

Subject: Computer Science and Engineering

Chapter: Java Programming

Keyword:

Java, input, output, programming, statements, if-else, loops, print, string. while, public, void, static, main, number, occurrence, expression, user, test code, activity, input, three tests, perform, values