Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a method that gets an array of strings and a string, the method returns an int. It counts how many times a string appears

Create a method that gets an array of strings and a string, the method returns an int.

It counts how many times a string appears in the array and returns the count.

for example (pseudo code):

array = ["a","foo","bar","foo","blabla","foo"]

string = "foo"

count_appearance(array, string) will return 3 because array has 3 appearances of "foo" string.

Call this method from the main method, and print returned result from the main method.

--------------------------------------------------------------

import java.util.*;

class Main { public static void main(String[] args) { //TODO Complete the code

} public static int count_appearance(String[] arr,String t) { //Write Your Code Here

return -1; } //end count_appearance

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

how paid advitizing changed on Instagram?

Answered: 1 week ago