我還沒有完成這個,但如果我已經有錯誤沒有進展。這裏是我的代碼..2錯誤:表達式的非法開始[Java]
public static void main(String[] args)
{
Scanner inputDevice = new Scanner(System.in);
System.out.print("Please enter the name of student ==> ");
studentName = inputDevice.nextInt();
inputDevice.nextLine();
System.out.printIn("Enter the mark for student "+ studentName " out of 65 ==> ");
studentMark = inputDevice.nextInt();
inputDevice.nextLine();
}
1號錯誤: ')' 預期
System.out.printIn("Enter the mark for student "+ studentName " out of 65 ==> ");
第二個錯誤:表達非法啓動
System.out.printIn("Enter the mark for student "+ studentName " out of 65 ==> ");
我非常新的哈哈。我不明白爲什麼我的第二打印是給我一個錯誤
'studentName'應該是'字符串studentName','studentMark'應該是'INT studentMark',不是嗎?此外,您永遠不會將'nextLine()'的返回值賦值給任何東西... – domsson
哇,7行中有5行有錯誤或不需要。我給你寫了一份所有問題的清單,以便你能夠理解和解決它們,更重要的是,在未來阻止這些問題。然而,下一次請給自己一杯咖啡,仔細閱讀你的代碼(以及錯誤信息),以便在這裏詢問之前自己發現一些這些問題。 – domsson