Here’s the link to the project I’m dealing with: https://www.codecademy.com/paths/introduction-to-android-with-java/tracks/java-arrays-and-loops/modules/cumulative-project-4/projects/unquote-game-logic-pt-ii
Hello! I am working on the Android Studio Cumulative Project No. 4 and I am stuck on step 14. I created my .onAnswerSubmission method and the part I am stuck on is with my if statement. The error that shows when I execute my code (shown below) is:
error: non-static method isCorrect() cannot be referenced from a static context
if (Question.isCorrect()) {
^
1 error
My Code:
// TODO #5 add getCurrentQuestion() here
Question getCurrentQuestion() {
return questions.get(currentQuestionIndex);
}
// TODO #6 add onAnswerSubmission() here
void onAnswerSubmission() {
getCurrentQuestion();
if (Question.isCorrect()) {
totalCorrect = totalCorrect + 1;
}
}
I thought what I was doing was right because I have to refer to the method in my Questions.java file, specifically my isCorrect method. However, I keep receiving that error, so any help is much appreciated!!