任何人都可以告訴我是什麼導致一個非常基本的程序中的Java錯誤我想寫?Java錯誤 - java:類,接口或枚舉預計
我接收到的錯誤表示:錯誤:(27,1)的java:類,接口,或枚舉預期
這裏是包名下面的代碼。
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner kbd = new Scanner(System.in);
String s = "";
boolean isOk = true;
while (isOk)
{
System.out.print("Key in a numeric string (Enter minus sign - to quit): ");
s = kbd.nextLine();
char c = s.charAt(0);
if (c == '-')
{
isOk = false;
System.out.print("You have quit the program.");
return;
}
}
}
}
}
看看你的'}'(從最後的第4行) – 2017-09-14 05:25:21
你在代碼的最後有一個額外的右括號。 –
謝謝蒂姆,那很快就有幫助! –