0
這是什麼問題,我得到一個錯誤,指出:解析時到達文件結尾。我該如何解決這個問題? 我曾嘗試沒有結果在解析時到達文件結尾,
public class FindMin
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int smallest = 9999999;
String userInput;
boolean quit = false;
System.out.println("This program finds the smallest number"
+ " in a series of numbers");
System.out.println("When you want to exit, type Q");
while(quit != true)
{
System.out.print("Enter a number: ");
userInput = keyboard.next();
if(userInput.equals("Q")) userInput.equals("q");
{
if(quit == true) {
}
else
{
int userNumber = Integer.parseInt(userInput);
if(UserNumber < smallest)
smallest = userNumber;
}
}
System.out.println("The smallest number is " + smallest);
System.exit(0);
}
最後完成編輯:) – JoeC
沒有工作,IM仍然得到同樣的錯誤 – user3015774
你確定你使用的是最新的版本?只是複製整個塊並更換主塊再次 我只是想,這裏是輸出 '如果你想退出該程序發現在一系列數字 的最小數量,Q型 輸入一個數字:5 輸入一個數字:6 輸入一個數字:4 輸入一個數字:7 輸入一個數字:● 最小的號碼是4' – JoeC