第七章第八题(求数组的平均值)(Average the array)
- 7.8(求数组的平均值)使用下面的方法头编写两个重载的方法,返回数组的平均数:
public static int average(int[] array)
public static double average(double[] array)
7.8(Average the array)Write two overloaded methods using the following method headers to return the average of the array:
public static int average(int[] array)
public static double average(double[] array) - 参考代码:
package chapter07;
import java.util.Scanner;
public class Code_08 {
public static void main(String[] args)