数值求最大值、最小值、总和、平均值
- 一个点:如何随机生产两位数的数组
Math.Random()*(b-a+1)+a
其中:a和b表示这个数的范围:[a,b]
代码实现:
package com.array.test;
/**
* @author: LYM
* @description 数组最大值、最小值、总和、平均数练习
* @version: V1.0
* @date: 2022/2/27 14:13
*/
public class ArrayTest01 {
public static void main(String[] args) {
//定义一个长度为10的一维数组
int[] arr=new int[10];
for(int i=0;i<arr.length;i++)