1.数组找最值
package com.itheima.arry; public class ArrayDemo7 { public static void main(String[] args) { //掌握数组元素求最值 int[] faceScore={15,9000,10000,20000,9500,-5}; int max=faceScore[0]; for (int i = 1; i < faceScore.length; i++) { // if(max<faceScore[i]){ // max=faceScore[i]; // }
max=max<faceScore[i]?faceScore[i]:max; } System.out.println(max); } }
标签:JAVA,int,max,faceScore,案例,数组,public From: https://www.cnblogs.com/pengsuoqun123/p/18041963