public class Test2 {
/*
查找一个给定数组中的最大值和最小值。
*/
public static void main(String[] args) {
int [] arr = {23,45,67,21,10,5,33,53,12,89};
int max = arr[0], min = arr[0];
for (int i = 1; i<arr.length;i++){
if (arr[i]>max){
max = arr[i];
}
if(arr[i]<min){
min = arr[i];
}
}
System.out.println("Maximum value in the array:"+max);
System.out.println("Maximum value in the array:"+min);
}
}