1  import java.util.Scanner;
  2  
  3  public class QuestionDemo
  4  {
  5     public static void main(String[] args)
  6     {
  7        Question[] quiz = new Question[2];
  8  
  9        quiz[0] = new Question("Who was the inventor of Java?");
 10        quiz[0].setAnswer("James Gosling");      
 11  
 12        ChoiceQuestion question = new ChoiceQuestion(
 13           "In which country was the inventor of Java born?");
 14        question.addChoice("Australia", false);
 15        question.addChoice("Canada", true);
 16        question.addChoice("Denmark", false);
 17        question.addChoice("United States", false);
 18        quiz[1] = question;
 19  
 20        Scanner in = new Scanner(System.in);
 21        for (Question q : quiz)
 22        {
 23           q.display();
 24           System.out.print("Your answer: ");
 25           String response = in.nextLine();
 26           System.out.println(q.checkAnswer(response));      
 27        }
 28     }
 29  }
 30