public class ArrayTest1 {
public static void main(String[] args) {
int[] arr = { 33, 22, 66, 66, 11, 44 };
// 定义参照物
int max = arr[0];
for (int i = 0; i < arr.length; i++) {
if (arr[i] > max) {
max = arr[i];
}
}
System.out.println("数组的最大值为:" + max);
int min = arr[0];
for (int i = 0; i < arr.length; i++) {
if (arr[i] < min) {
min = arr[i];
}
}
System.out.println("数组的最小值为:" + min);
}
}