public class Demo07 { public static void main(String[] args) { int arr[]={44,22,33,66,77}; int max=arr[0]; for (int i = 0; i < arr.length; i++) { if(max<arr[i]){ max=arr[i]; } } System.out.println(max); } }
打印结果:77
public class Demo07 { public static void main(String[] args) { int arr[]={44,22,33,66,77}; int max=arr[0]; for (int i = 0; i < arr.length; i++) { if(max<arr[i]){ max=arr[i]; } } System.out.println(max); } }
打印结果:77