class ArrayDemo
{
public static int getMax(int[] arr)
{
int max = 0;
for (int x = 1;x<arr.length ;x++ )
{
if(arr[x]>arr[max])
max = x;
}
reture arr[max];
}
public static void main(String[] args)
{
int[] arr = {5,1,6,4,2,8,9};
int max = getMax(arr);
System.out.println("arr="+arr);
}
}
,为什么运行结果老是数组地址?arr=[I@1fb8ee3?
|
|