我在NetBeans IDE中的输出出现问题

时间:2018-08-22 03:35:58

标签: java netbeans collections

当我输入与元素完全相同的答案时,输出为Right:0Wrong: 10a1a2a3 ...是我从用户输入的文本框中获得的答案。我该如何解决?

private void checkUsersAnswers() {
    Collections.addAll(quizUsersAnswers, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
    Collections.addAll(quizAnswers, "Aphrodite", "Apollo", "Ares", "Artemis","Demeter", "Dionysus", "Hades", "Hephaestus", "Hera");
    for (int i = 0; i < quizAnswers.size(); i++) {
        if (quizUsersAnswers.contains(quizAnswers.get(i))) {
            intRight++;
        } else {
            intWrong++;
        }
    }
}

private void btnCheckUsersAnswersActionPerformed(java.awt.event.ActionEvent evt) {                                                     
    checkUsersAnswers();
    this.lblMessageRightWrong.setText("Right: "+intRight+"Wrong: "+intWrong);
} 

我不知道为什么输出错误。

0 个答案:

没有答案