Question: Below is a function that counts the number of occurrences of a specific target character in an array of characters. At the end of the
Below is a function that counts the number of occurrences of a specific target character in an array of characters. At the end of the code, the value of answer indicates how many times target appears in the array. Rewrite the code so that it works correctly when the list array is an array of String objects (the array does not contain any null values). Your method should throw an IllegalArgumentException if the target parameter is null. int count ( char [] list, char target ) { int answer = 0; for (int i = 0; i
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
