Question: Write java ( define ) a public static method named count, that takes an ArrayList of Integer, and an int as arguments and returns (
Write java define a public static method named count, that takes an ArrayList of Integer, and an int as arguments and returns as an int a count of the number of times the second argument value appears in the ArrayList.
For example:
given an ArrayList named myList that contains this list of values:
countmyList should return
countmyList should return
You may wish to write some additional code to test your method.
Helpful Hints:
Use a loop to iterate over the elements of the argument ArrayList
For each element in the array, you must decide to either count it or not
Return the count at the end
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
