class Demo0318
{
public static void main (String[] args)
{
int [] arr = {4,54,23,67,89,456};
int max =0;
for (int x =0;x<arr.length;x++)
{
if (arr[x]<arr[max])
max=x;
}
System.out.println("max="+arr[max]);
}
}作者: 关山明月 时间: 2015-3-18 22:37
这个是获取最小值吧。。。作者: 混乱的世界 时间: 2015-3-18 22:54
if 的条件错误,应该是arr[x]>arr[max]作者: java梦想 时间: 2015-3-18 23:07