public static void main(String[] args) {
int[]array={1,55,37,86,84,99,3567,357,478,537,34};
System.out.println(findMaxMin(array));
//为什么不返回数字?它只是返回[I @ 48cf768c。我希望它返回3567和1。
}
public static int[] findMaxMin(int[]answer){
int max = answer[0];
for (int i = 0; i < answer.length; i++) {
if (answer[i]>max){
max=answer[i];
}
}
int min = answer[0];
for (int i = 0; i < answer.length; i++) {
if (answer[i]<min){
min=answer[i];
}
}
int[]array={max,min};
return (array);
//返回的是地址而不是实际数字 }