代码
提交代码
public class ArrayGetMaxDemo {
public static void main(String[] args) {
int[] arr = {20, 30, 15, 70, 92, 11};
int max = arr[0];
for (int i = 0; i < arr.length; i++) {
if (arr[i] > max) {
max = arr[i];
}
}
System.out.println("最大值为:" + max);
}
}
运行结果