以下eclipse中的代碼在eclipse中給出了一個「}」在classbody中丟失的情況,但是在終端中編譯得很好。任何線索?Eclipse Java:Eclipse抱怨缺少大括號在類中
package quiz;
public class Session {
static int currentQuestion = 0;
private Sentence[] sentences; // for building questions
private Question[] questions;
public void generateReport(Session publishSession) {
}
public int getRightQuestionCount() {
}
public int getWrongQuestionCount() {
}
public int calculatePercent() {
}
public Question getQuestionAtIdx(int index) {
return questions[index];
}
public Question getPreviousQuestion() {
return getQuestionAtIdx(--currentQuestion);
}
public Question getNextQuestion() {
return getQuestionAtIdx(--currentQuestion);
}
public void setQuestionAtIdx(int index, Question) {
}
}
嘗試剪切並粘貼代碼或清理項目。在很多情況下,Eclipse然後識別非錯誤。 :) – Thomas
此外,getPreviouseQuestion()方法將「 - currentQuestion」描繪爲藍色,但其後的方法getNextQuestion不會。最後}有一個錯誤,說我應該刪除這個令牌 – Asaf
@Asaf ..看看更新後的答案.. ... – ngesh