How to put "game over" at the end of my trivia game when the last question is answered.
My java code trivia game runs and plays perfectly until it gets to the last question. As soon as I answer the last question (54 of them) it comes up and says that it has "unexpectedly". I know this is because I don't have anything in my code to stop the program, so I tried an if/else statement in the update question method but it didn't do anything. Can someone tell me how to end the app with a "game over" statement or something? private void updateQuestion() { mQuestionView.setText(mQuestionLibrary.getQuestion(mQuestionNumber)); mButtonChoice1.setText(mQuestionLibrary.getChoice1(mQuestionNumber)); mButtonChoice2.setText(mQuestionLibrary.getChoice2(mQuestionNumber)); mButtonChoice3.setText(mQuestionLibrary.getChoice3(mQuestionNumber)); mAnswer = mQuestionLibrary.getCorrectAnswer(mQuestionNumber); if (mQuestionNumber > 56) { System.out.println("Game Over!"); }else{ mQuestionNumber++;