我正在尝试找到数组中的最高和最低数字,但我不确定为什么我的代码没有正确工作。它给出了0和56的输出结果。我知道为什么会得到0,但是56是从哪里来的呢?
package test;
public class Test {
public static void main(String[] args) {
int[] numbs = { '2', '4', '2', '8', '4', '2', '5'};
int count = 0;
int low = 0;
int high = 0;
while(count < numbs.length)
{
if(numbs[count]< low) {
low = numbs[count];
}
if(numbs[count]> high) {
high = numbs[count];
}
count++;
}
System.out.println(low);
System.out.println(high);
}
}