以下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