package www.zhoushuiping.com; |
public class ShiErTi { |
public static void main(String[] args) { |
int arr[] = { 12 , 3 , 4 , 56 , 78 , 89 , 78 , 78 }; |
int max = 0 ; |
int sec = 0 ; |
for ( int i= 0 ;i<arr.length;i++) { |
if (arr[i]>=max) { |
max = arr[i]; |
sec = max; |
} |
} |
int maxShuzu = max+sec; |
System.out.println( "数组两个数相加和最大是:" +maxShuzu); |
} |
} |