QuizDemo.java.html

  1  public class QuizDemo
  2  {
  3     public static void main(String[] args)
  4     {
  5        Question first = new Question();
  6        first.setText("Who was the inventor of Java?");
  7        first.setAnswer("James Gosling");      
  8  
  9        ChoiceQuestion second = new ChoiceQuestion();
 10        second.setText("In which country was the inventor of Java born?");
 11        second.addChoice("Australia", false);
 12        second.addChoice("Canada", true);
 13        second.addChoice("Denmark", false);
 14        second.addChoice("United States", false);
 15  
 16        Quiz q = new Quiz();
 17        q.addQuestion(first);
 18        q.addQuestion(second);
 19        q.presentQuestions();
 20     }
 21  }