当我编译我的代码时,我不断收到这个错误。另外,在我收到这个错误之前,我的显示器只显示最大的数字而不是最小的数字。任何帮助将不胜感激。谢谢你的时间。
LargestAndSmallest.java:51: 解析时到达文件末尾��������
} 0000 0000 0000 0000 0000 0000 ^ 1 error
这是我的代码:
import java.util.Scanner;
public class LargestAndSmallest
{
public static void main(String[] args)
{
int input;
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter an integer number or -99 to quit: ");
input = keyboard.nextInt();
int MIN_VALUE = 0;
int MAX_VALUE = 0;
while (input != -99)
{
if (input > MAX_VALUE)
{
MAX_VALUE = input;
}
else if (input < MIN_VALUE)
{
MIN_VALUE = input;
}
if (MAX_VALUE == -99)
{
System.out.print("\nYou did not enter any number");
}
else
{
System.out.print("\nLargest: " + MAX_VALUE);
System.out.print("\nSmallest:" + MIN_VALUE);
}
}
}