Question: Is there any bug in the code? /** * Return the average of elements in the input array. * @param * @return array input array

Is there any bug in the code?
/** * Return the average of elements in the input array. * @param * @return array input array to calculate the average from. the average of all numbers in the array. */ public static double findAvg(int array[]) { // short circuit protects null access null && array.length if (array 0) { return 0; double sum = 0; // sum up numbers in the array and calculate the average for (int i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
