Results 1 to 2 of 2

Thread: Problem

  1. #1
    saytri is offline Member
    Join Date
    Dec 2007
    Rep Power

    Default Problem

    I am making a quiz, and storing the questions in a textfile. I managed to call the questions from Java. Now i'm doing the answer part. Which is the best method of storing the answers so that i could then compare them with the answers entered by the user and determine whether the user answered correctly or not? Thanks a lot! :-):)

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    If you know the number of questions you have you can make up an array to store the user-entered answers.
    If not you can use an ArrayList to store the answers.
    Java Code:
    String answers = new String[numberOfQuestions];
    for(questions asked)
        answers[j] = nextLine
    List<String> list = new ArrayList<String>();
    for(questions asked)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts