Question: The frequency ( ) method is supposed to return the number of occurrences of target within the array. Identify the location of any errors. public

The frequency() method is supposed to return the number of occurrences of target within the array. Identify the location of any errors.
public static int[] frequency(int[] nums, int target){
int index;
int count =0;
for(index =0; index < nums.length; ++index){
if(nums[index]== target){
++count;
}
}
return count;
}
Group of answer choices
The code has no errors
Only the method signature has an error
Only the method body has errors
Both the method signature and body have errors

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!