虽然我看到了一些关于同一主题的问题,但它们对我的情况还不够具体。
import java.util.*;
public class Kap3Oppg5 {
public static void main(String[] args) {
int x = 0;
int tabell[] = new int[10];
int heltall;
Scanner in = new Scanner(System.in);
int minstetall = tabell[0];
while (x < 10) {
System.out.println("Tast inn neste tall:");
heltall = in.nextInt();
tabell[x] = heltall;
x = x + 1;
}
for (int i=0;i<tabell.length;i++) {
if (tabell[i] < tabell[0])
minstetall = tabell[i];
}
System.out.print(minstetall);
}
}
为什么这不是打印最低数字?