我正在尝试使用数组,但我不确定这是否是正确的方法。
我希望第一个和第二个整数输入相互比较,然后如果有更多它们相互比较。
所以这里是一段代码。
for(int ii = 1, j = 0; j <= copySel ; ii++, j++) {
int x = 0;
int[x] check;
// Prompt as follows
System.out.print("Enter value " + ii + ": ");
try {
c = Get();
}
catch (InputMismatchException e) {
// Display the following text in the event of an invalid input
System.out.println("Invalid input!");
ii--; x--;
} check = c; x++;
System.out.print(check + " "+ x);
}
我的实际格式还不错。我需要尝试根据用户输入的整数数找到最小值
static int Get()
{
Scanner intFind = new Scanner(System.in);
int select;
select = intFind.nextInt();
return select;
}
这是获取() ^
我不能连续使用 min(x, y) 吗?